Lens smooth turning setting method and system based on automatic path finding, and storage medium
By setting the pre-steering threshold of the lens and calculating the angle angle, the lens steering time is extended, and the visual vertigo problem caused by the fast rotation of the lens in traditional automatic pathfinding is solved, and the comfort and fluency of the user experience is improved.
Patent Information
- Application Number
- CN202411424187.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-12
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-10-12
AI Technical Summary
In the traditional automatic pathfinding method, the high frequency of the lens rotation leads to visual vertigo, especially in the case of complex paths, which affects the user's experience.
By setting the pre-steering angle and distance threshold of the lens, calculate the angle angle between the azimuth vector and the direction vector, determine whether it exceeds the threshold. If it exceeds the threshold, perform pre-steering to extend the steering time, control the lens to turn according to the angle angle, and ensure slow rotation Evenly, avoid sudden steering.
It effectively relieves visual dizziness, improves visual comfort during automatic pathfinding, and ensures the smoothness and authenticity of the user experience.
Smart Images

Figure CN118967986A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual and reality technology, and in particular to a method, system, and storage medium for setting smooth camera turning based on automatic pathfinding. Background Technology
[0002] Virtual reality (VR) technology primarily utilizes computer technology, integrating the latest advancements in 3D graphics, multimedia, simulation, display, and server technologies. With the aid of computers and other equipment, it creates a realistic 3D virtual world offering a multi-sensory experience encompassing sight, touch, and smell. Therefore, resource display is the most crucial aspect of VR technology. Since users can move within the constructed virtual world, it's essential to ensure that resources follow the user's movements during rendering to guarantee a smooth user experience.
[0003] Automatic pathfinding, also known as pathfinding algorithms, is a technology in the field of artificial intelligence used in games or other simulated environments to enable characters to automatically find the optimal path from a starting point to a destination. It is widely used in virtual scenes. Since users mostly move characters in a first-person perspective in virtual scenes, rapid camera movement can cause visual dizziness. Furthermore, in virtual scenes, the user's camera and the character's orientation are synchronized; as the character rotates, the camera follows. In traditional automatic pathfinding, if the path is complex, the character's orientation constantly changes during each segment of the path, and the camera rotates simultaneously with these orientation changes. This high frequency of rotation can easily cause discomfort for the user. Therefore, the camera turning method used in traditional automatic pathfinding still has certain shortcomings. Summary of the Invention
[0004] The purpose of this invention is to solve the problem of visual dizziness caused by the rotation of the user's lens during automatic pathfinding by proposing a method, system and storage medium for smooth lens turning based on automatic pathfinding. It has the advantages of using pre-turning and lengthening the turning distance, which can effectively alleviate dizziness for paths with large rotation amplitude.
[0005] In a first aspect, the present invention achieves the above-mentioned objective through the following technical solution: a method for setting smooth lens turning based on automatic pathfinding, the method comprising the following steps: Set the angle and distance thresholds for the user's camera pre-turn; Obtain the user's current location coordinates P1 and the location coordinates P2 of the target point in the next path segment, and calculate the orientation vector based on P1 and P2; Obtain the orientation vector of the user's current camera, and calculate the angle between the orientation vector and the orientation vector; Determine whether the included angle exceeds the angle threshold. If it does not exceed the threshold, the process ends; if it does exceed the threshold, distance detection is initiated. The system calculates the remaining distance the user has moved in the current segment of the path in real time. When the remaining distance is less than the distance threshold, the system controls the user's camera to turn according to the included angle.
[0006] Preferably, the target point is the end point of the next path segment, and each path segment is formed by a start point and an end point.
[0007] Preferably, the method further includes detecting the path length of the next segment. If the path length is less than a distance threshold, the starting point of the next segment is ignored, and the current segment and the next segment are merged into a new current segment.
[0008] Preferably, the starting point of ignoring the next path segment is the point at which the user's camera is locked when the user passes the starting point.
[0009] Preferably, the method for calculating the remaining distance the user has moved in the current segment path in real time is as follows: Real-time acquisition of the user's current location coordinates P1 and the end point P3 in the current segment path; The distance between the two coordinates P1 and P3 is calculated as the remaining distance.
[0010] Preferably, the method for controlling the user's lens to turn according to the included angle is as follows: Get the numerical value of the included angle; Set a fixed time interval for the user to move a certain distance threshold; Calculate the steering rate: Steering rate = included angle / fixed time; When executing a pre-steering command, the user's camera rotates uniformly according to the steering rate.
[0011] Secondly, the present invention achieves the above-mentioned objective through the following technical solution: a lens smooth turning setting system based on automatic pathfinding, the system comprising: The threshold setting unit is used to set the angle threshold and distance threshold for the user's lens pre-turning. The orientation calculation unit is used to obtain the user's current location coordinates P1 and the location coordinates P2 of the target point in the next path, and calculate the orientation vector based on P1 and P2. An angle calculation unit is used to obtain the orientation vector of the user's current camera and calculate the angle between the orientation vector and the orientation vector. An angle determination unit is used to determine whether the included angle exceeds the angle threshold. If it does not exceed the threshold, the process ends; if it exceeds the threshold, distance detection is activated. The steering control unit is used to calculate the remaining distance the user has moved in the current segment of the path in real time. When the remaining distance is less than the distance threshold, it controls the user's camera to turn according to the included angle.
[0012] Preferably, the target point is the end point of the next path segment, and each path segment is formed by a start point and an end point.
[0013] Preferably, the system further includes a path length detection unit, used to detect the path length of the next segment. If the path length is less than a distance threshold, the starting point of the next segment is ignored, and the current segment and the next segment are merged into a new current segment.
[0014] Thirdly, the present invention achieves the above-mentioned objective through the following technical solution: a storage medium storing a computer program thereon, wherein when the computer program is executed by a processor, the lens smooth turning setting method based on automatic pathfinding as described in the first aspect is implemented.
[0015] Compared with the prior art, the beneficial effects of the present invention are as follows: The present invention uses the current position and the target point in the next path to calculate the angle that the view needs to rotate when switching from the current path to the next path, and then judges whether pre-turning is required based on the angle threshold. In this way, during the automatic path finding process, the camera turns in advance before switching from the current path to the next path, which lengthens the turning time and avoids the phenomenon of sudden turning at the point. In the three-dimensional scene, the slow and uniform turning can greatly reduce the dizziness caused by the view rotation, thereby improving the visual comfort during automatic path finding. Attached Figure Description
[0016] Figure 1 This is a flowchart of the lens smooth turning setting method based on automatic pathfinding according to the present invention.
[0017] Figure 2 This is a schematic diagram showing the distribution of the starting and ending points when the path length is short according to the present invention.
[0018] Figure 3 This is a schematic diagram of the lens smooth turning setting system based on automatic pathfinding according to the present invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Example 1 like Figure 1 As shown, a method for setting smooth lens turning based on automatic pathfinding includes the following steps: This solution sets pre-tilt angle and distance thresholds for the user's camera. Pre-tilt addresses the visual dizziness caused by excessively fast or large camera rotations. In traditional automatic pathfinding in 3D scenes, the camera moves synchronously with the character. For example, when the character walks straight ahead, the camera captures the scene directly in front of the character; when the character turns right, the camera follows. It's clear that the camera rotation occurs at the moment of direction change. If the rotation angle is too large, the scene in the camera moves rapidly, causing the user's eyes to lose focus and resulting in dizziness. This is especially true when the rotation frequency increases along the path, as the constantly moving image intensifies the dizziness. Pre-tilt lengthens the rotation time, effectively slowing down the image's movement. This reduces the likelihood of dizziness and doesn't fundamentally change the overall automatic pathfinding time. Simply slowing down the camera rotation speed would inevitably lead to a sense of visual delay, also increasing the automatic pathfinding time. Therefore, in this step, the pre-turn angle threshold and distance threshold are preset. The angle threshold is used to determine whether pre-turning is needed. For the switching between path points that do not require pre-turning, it is consistent with the normal automatic pathfinding rhythm. The distance threshold is used to determine whether to start pre-turning. It takes time for the user to move on the path. By controlling the user to turn while walking within the distance threshold, the turning time is indirectly increased without increasing the overall automatic pathfinding time. It can also slow down the turning rate, thereby reducing visual dizziness.
[0021] Obtain the user's current location coordinates P1 and the target point's location coordinates P2 in the next path segment. Calculate the orientation vector based on P1 and P2. As mentioned in the previous steps, the angle threshold is used to determine whether pre-turning is required. The determination is based on whether the user's direction changes when moving to the next path segment. If the direction changes, a certain angle must be turned. To calculate this angle, the angle between the two directions needs to be calculated. Therefore, in this step, the direction vector between the current location and the selected target point needs to be calculated.
[0022] Obtain the current orientation vector of the user's camera and calculate the angle between the orientation vector and the orientation vector. The camera moves synchronously with the character, so when the user is in the current position, the orientation of the camera is the user's orientation. Here, we only need to obtain the user's current orientation to determine the orientation vector of the camera. The orientation vector of the camera is a direction, and the direction vector calculated in the above steps is also a direction. Therefore, the angle between the two direction vectors can be calculated, and this angle is the basis for determining whether pre-turning is needed.
[0023] Determine whether the included angle exceeds the angle threshold. If it does not exceed the threshold, the process ends; if it does exceed the threshold, distance detection is activated. Since this application uses the distance threshold to slow down the rotation rate, it will still affect the synchronization of the camera and character movement in some aspects. Moreover, not all camera rotations will cause dizziness. Therefore, the included angle is compared with the angle threshold. If the included angle is small and does not exceed the angle threshold, it means that even with normal camera rotation during automatic pathfinding, dizziness is not likely to occur. Therefore, there is no need to switch the pre-turn operation of this solution. If it exceeds the threshold, pre-turning is required, and the next step needs to be performed.
[0024] The remaining distance the user has traveled in the current path segment is calculated in real time. When the remaining distance is less than a distance threshold, the camera is controlled to turn at an angle. This step details how the camera pre-turn is performed. Since each path segment has a start point and an end point, when the user reaches the end point, it means the current path segment has ended. However, the pre-turn operation cannot be performed exactly at the end, as is the traditional method. Therefore, the remaining distance of the current path segment needs to be calculated in real time. Specifically, this is done by continuously detecting the distance between the user's position coordinates and the coordinates of the end point of the current path segment. The remaining distance is obtained by subtracting the two coordinates until the remaining distance reaches the distance threshold. At this point, the camera pre-turn operation is performed, and the camera's turning angle is the previously calculated angle. This way, when the user reaches the end point, the turning operation ends, and the user's orientation is consistent with the target point of the next path segment. When the user moves towards the target point, the orientation will not change, and therefore the camera will not rotate. Through the pre-turn operation, walking on two different path segments in different directions is completed, ensuring a realistic experience while reducing visual dizziness.
[0025] The specific method for calculating the remaining distance is as follows: The method for calculating the remaining distance the user has moved in the current path segment in real time is as follows: Real-time acquisition of the user's current location coordinates P1 and the end point P3 in the current segment path; The distance between the two coordinates P1 and P3 is calculated as the remaining distance.
[0026] To ensure the target point determines the path direction, the target point is the end point of the next path segment. Each path segment consists of a start point and an end point. For two adjacent path segments, the end point of the previous path and the start point of the next path must coincide. When the user walks on the path, they move towards the end point. Therefore, knowing the end point of the next path segment determines the direction of movement. Choosing the end point of the next path segment as the target point facilitates calculation. In reality, any point on the path can be used as the target point. Since all path points in the automatic pathfinding are known when the pathfinding is set, this design is simply to reduce computation.
[0027] In practical applications, there may be situations where a path is relatively short. If the pre-turning conditions of this solution are met, then this shorter path also needs pre-turning. Although pre-turning can be performed according to this solution, it consumes some computational resources. Therefore, to avoid this phenomenon, some pre-turning operations can be discarded. This method also includes detecting the path length of the next segment. If the path length is less than a distance threshold, the starting point of the next segment is ignored, and the current segment and the next segment are merged into a new current segment. In this step, when the path length is shorter than the distance threshold, if it is not ignored, then the user needs to pre-turn as soon as they reach the next segment, which may result in two camera turns in a short period of time. Although pre-turning reduces the turning rate, two turns with very close time intervals can still affect the visual perception. Therefore, this step ignores the starting point of the shorter next segment and merges them into the same path. When the user pre-turns on the current segment, the ending point of the next segment is used as a reference for calculating the remaining distance, fixing the possible two camera turns into one camera turn. Figure 2 As shown, a1-a2 is the current segment path. The distance between a2 and a3 is shorter, so we ignore a2, making the current segment path a1-a3. The next segment path becomes a3-a4. Therefore, a pre-turn is performed before reaching a3, so that when the user reaches the position of a3, they are facing the direction of a4. This step is optimized for special cases and reduces the user's visual dizziness.
[0028] Still for reference Figure 2The "ignore the starting point of the next path segment" means locking the user's camera orientation when the user passes the starting point. The "ignore a2" mentioned above actually means that during the user's movement from a1 to a2 to a3, before any pre-turning is performed, the camera view always maintains the direction the user is facing during the path from a1 to a2. Ignoring a2 here does not mean that the user still has to walk to a2, but the camera does not rotate. This is because in traditional automatic pathfinding, the camera rotates when the orientation of a point changes.
[0029] To ensure smooth and comfortable lens pre-tilt, the method for controlling the user's lens to tilt according to the included angle is as follows: Get the numerical value of the included angle; Set a fixed time interval for the user to move a certain distance threshold; Calculate the steering rate: Steering rate = included angle / fixed time; When executing a pre-steering command, the user's camera rotates uniformly according to the steering rate; The distance a user walks is fixed, and the walking speed is also fixed, so it is easy to calculate the fixed time for pre-turning. Then, the turning speed can be easily calculated using the fixed time for pre-turning and the included angle of pre-turning. By simply executing this turning speed, the camera can turn evenly when the user walks a certain distance threshold, resulting in a better turning effect.
[0030] Example 2 like Figure 3 As shown, a lens smooth turning setting system based on automatic pathfinding includes: The threshold setting unit is used to set the angle threshold and distance threshold for the user's lens pre-turn.
[0031] The orientation calculation unit is used to obtain the user's current location coordinates P1 and the location coordinates P2 of the target point in the next path, and calculate the orientation vector based on P1 and P2.
[0032] An angle calculation unit is used to obtain the orientation vector of the user's current camera and calculate the angle between the orientation vector and the orientation vector.
[0033] An angle determination unit is used to determine whether the included angle exceeds the angle threshold. If it does not exceed the threshold, the process ends; if it does exceed the threshold, distance detection is activated.
[0034] The steering control unit is used to calculate the remaining distance the user has moved in the current segment of the path in real time. When the remaining distance is less than the distance threshold, it controls the user's camera to turn by an included angle. The method for calculating the remaining distance the user has moved in the current segment of the path in real time is as follows: Real-time acquisition of the user's current location coordinates P1 and the end point P3 in the current segment path; The distance between the two coordinates P1 and P3 is calculated as the remaining distance.
[0035] The target point is the end point of the next path segment, and each path segment is formed by a start point and an end point.
[0036] The system also includes a path length detection unit, which is used to detect the path length of the next segment. If the path length is less than the distance threshold, the starting point of the next segment is ignored, and the current segment path and the next segment path are merged into a new current segment path.
[0037] The "ignore the starting point of the next path segment" means locking the user's camera orientation when the user passes the starting point.
[0038] In the steering control unit, the method for controlling the user's camera to turn according to the included angle is as follows: Get the numerical value of the included angle; Set a fixed time interval for the user to move a certain distance threshold; Calculate the steering rate: Steering rate = included angle / fixed time; When executing a pre-steering command, the user's camera rotates uniformly according to the steering rate.
[0039] Example 2 is essentially the same as Example 1, so the specific working principle of each unit will not be described again.
[0040] Example 3 This embodiment proposes a storage medium comprising a program storage area and a data storage area. The program storage area stores the operating system and programs required for running instant messaging functions; the data storage area stores various instant messaging information and operation instruction sets. The computer program is stored in the program storage area. When the computer program is executed by a processor, it implements the smooth camera steering method based on automatic pathfinding as described in Embodiment 1. The processor may include one or more central processing units, or a digital processing unit, etc.
[0041] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, it is intended that all variations falling within the meaning and scope of equivalents of the claims be included within the present invention.
[0042] Furthermore, it should be understood that although this specification describes embodiments, not every embodiment contains only one independent technical solution. This narrative style is merely for clarity. Those skilled in the art should consider the specification as a whole, and the technical solutions in each embodiment can also be appropriately combined to form other embodiments that can be understood by those skilled in the art.
Claims
1. A method for setting smooth camera steering based on automatic pathfinding. It is characterized in that The method comprises the following steps: Set the angle threshold and distance threshold for the user's lens pre-steering; Obtain the user's current position coordinates P1 and the position coordinates P2 of the target point in the next path, and calculate the orientation vector based on P1 and P2; Obtain the orientation vector of the user's current lens, and calculate the angle between the orientation vector and the orientation vector; Determine whether the angle exceeds the angle threshold, if not, end the process, if exceeded, start distance detection; The remaining distance that the user has moved in the current segment of the path is calculated in real time. When the remaining distance is less than the distance threshold, the user's camera is controlled to turn according to the angle.
2. The method for setting a smooth lens turn based on automatic pathfinding according to claim 1, It is characterized in that The target point is the end point of the next path, and each path is formed by a start point and an end point.
3. The method for setting a smooth lens turn based on automatic pathfinding according to claim 2, It is characterized in that The method also includes detecting the path length of the next path segment. If the path length is less than a distance threshold, ignoring the starting point of the next path segment, and merging the current path segment and the next path segment as a new current path segment.
4. The method for setting a smooth lens turn based on automatic pathfinding according to claim 3, It is characterized in that The ignoring of the starting point of the next path segment is to lock the user's camera orientation when the user passes the starting point.
5. The method for setting a smooth camera turn based on automatic pathfinding according to claim 2, It is characterized in that The method for calculating the remaining distance moved by the user in the current segment path in real time is: Obtain the user's current position coordinates P1 and the end point P3 in the current segment path in real time; The distance between the two coordinates is calculated based on P1 and P3 as the remaining distance.
6. The method for setting a smooth camera turn based on automatic pathfinding according to claim 1, It is characterized in that The method for controlling the user's lens to turn according to the angle is: Get the value of the angle; Set a fixed time for the user to move a distance threshold; Calculate the turning rate, turning rate = angle / fixed time; When executing the pre-turn command, the user's lens rotates evenly according to the turn rate.
7. A lens smooth steering setting system based on automatic path finding, It is characterized in that The system includes: A threshold setting unit, used to set an angle threshold and a distance threshold for pre-steering of the user's lens; A direction calculation unit, used to obtain the user's current position coordinates P1 and the position coordinates P2 of the target point in the next path, and calculate the direction vector according to P1 and P2; An angle calculation unit, used to obtain the orientation vector of the user's current lens, and calculate the angle between the orientation vector and the orientation vector; An angle determination unit, used to determine whether the angle exceeds the angle threshold, if not, then end, if exceeded, then start distance detection; The steering control unit is used to calculate in real time the remaining distance that the user has moved in the current segment of the path, and when the remaining distance is less than the distance threshold, control the user's lens to turn according to the angle.
8. The system for setting a smooth camera turn based on automatic pathfinding according to claim 7, It is characterized in that The target point is the end point of the next path, and each path is formed by a start point and an end point.
9. The system for setting a smooth camera turn based on automatic pathfinding according to claim 7, It is characterized in that The system also includes a path length detection unit for detecting the path length of the next path segment. If the path length is less than a distance threshold, the starting point of the next path segment is ignored, and the current path segment and the next path segment are combined as a new current path segment.
10. A storage medium, It is characterized in that A computer program is stored thereon, and when the computer program is executed by a processor, the method for setting a smooth lens turn based on automatic path finding as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Man-machine interaction method for AR helmet
CN108181994A
Actual and virtual space mapping method and system suitable for virtual roaming system
CN110853150A
Game display control method and device, electronic equipment and storage medium
CN111437604A
Auxiliary driving control method and device in game and electronic equipment
CN115487497A
Mission driven virtual character for user interaction
US20210104100A1
