Lens orientation control method and device, equipment and medium
By acquiring the movement direction of the camera target in real time in role-playing games, calculating the reverse camera offset parameters, and dynamically adjusting the camera position, the problem of visual blind spots in climbing systems is solved, improving the smoothness and immersion of the game.
Patent Information
- Application Number
- CN202511306478.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2025-12-12
AI Technical Summary
In existing role-playing games, the climbing system suffers from blind spots due to the camera-following mechanism, which weakens the smoothness of the climbing gameplay and increases player fatigue.
By determining the climbing status of the target in the camera lens, obtaining its real-time movement direction, calculating the reverse camera offset parameters, and continuously monitoring changes in the movement direction, the camera position is dynamically adjusted to avoid obstruction, thus achieving automatic camera adjustment.
It enhances the player's visual experience during climbing, reduces operational fatigue, and strengthens the game's immersion, ease of operation, and smoothness.
Smart Images

Figure 2388046A-6048-43BC-9FD3-19601909F9AC 
Figure 396571DC-3A8D-4ED8-90E9-9B67AEEE2324 
Figure 473F088D-8502-48CD-9F5B-9198C6C0A1E6
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a lens orientation control method and device, equipment and medium. BACKGROUND
[0002] In the open world scene of the existing role-playing games, the climbing system has become an important part of improving the game immersion and exploration fun of players. In order to present the dynamic of the character on the rock wall, building or other climbable surface to the player in real time, the graphics engine usually adopts a set of follow-up virtual camera mechanism: the camera is set to lock the fixed offset position behind or behind the side of the character, and synchronously translate with the displacement of the character, so as to ensure that the character is always in the center of the screen.
[0003] The follow-up virtual camera mechanism can maintain a good visual range when the game character runs or fights on the ground, but when the character enters the vertical or nearly vertical climbing state, the motion trajectory of the character often forms a ninety-degree or even larger angle with the default follow-up plane of the camera. Because the camera can only passively translate at the original horizontal offset parameter, it cannot actively adjust its orientation or spatial position around the character, resulting in a large area of the character's body, arms or the climbing surface itself being blocked in the picture, so that the player cannot accurately determine the relative relationship between the climbing height position of the character and the surrounding environment, and is forced to rely on repeated trial and error or constantly dragging the rotating view angle to complete the climbing path planning. Therefore, the visual blind area caused by the passive follow-up of the camera in the prior art not only weakens the smoothness of the climbing gameplay, but also increases the operation fatigue of the player due to the frequent adjustment of the view angle, thereby damaging the game experience of the player. SUMMARY
[0004] The purpose of the present application is to solve the above problems and provide a lens orientation control method and its corresponding device, equipment, non-volatile readable storage medium, and computer program product.
[0005] According to one aspect of the present application, a lens orientation control method is provided, comprising: determining that the current motion state of the lens target is a climbing state, and obtaining the real-time motion direction of the lens target; reading the lens offset parameter corresponding to the real-time motion direction, wherein the lens offset parameter includes a lens offset direction and a lens offset amplitude, and the lens offset direction has an inverse relationship with the real-time motion direction; calculating the target lens coordinates of the lens based on the lens offset direction and the lens offset amplitude, and driving the lens to move from the current coordinates to the target lens coordinates; continuously monitor the change of the movement direction of the lens target, update the lens offset parameter based on the real-time movement direction of the lens target exceeding a preset change angle threshold, drive the lens to move to the updated target lens coordinate based on the updated lens offset parameter until the lens target exits the climbing state.
[0006] According to another aspect of the present application, a lens orientation control device is provided, comprising: a state determination module configured to determine the current movement state of a lens target as a climbing state and acquire a real-time movement direction of the lens target; a parameter reading module configured to read a lens offset parameter corresponding to the real-time movement direction, wherein the lens offset parameter comprises a lens offset direction and a lens offset amplitude, and the lens offset direction is in an inverse relationship with the real-time movement direction; a lens movement module configured to calculate a target lens coordinate corresponding to the lens based on the lens offset direction and the lens offset amplitude, and drive the lens to move from a current coordinate to the target lens coordinate; a displacement updating module configured to continuously monitor the change of the movement direction of the lens target, update the lens offset parameter based on the real-time movement direction of the lens target exceeding a preset change angle threshold, drive the lens to move to the updated target lens coordinate based on the updated lens offset parameter until the lens target exits the climbing state.
[0007] According to another aspect of the present application, a lens orientation control device is provided, comprising a central processing unit and a memory, wherein the central processing unit is configured to call and run a computer program stored in the memory to perform the steps of the method described in the present application.
[0008] According to another aspect of the present application, a non-volatile readable storage medium is provided, which stores a computer program implemented according to the lens orientation control method in the form of computer readable instructions, and the computer program is called and run by a computer to perform the steps included in the method.
[0009] According to another aspect of the present application, a computer program product is provided, comprising computer program / instructions, which are executed by a processor to implement the steps of the method.
[0010] The lens orientation control method of the present application can improve the visual experience of the player during the character climbing process. By determining that the lens target enters the climbing state in real time, the motion direction of the lens target is obtained, and the lens offset parameter in the opposite direction of the real-time motion direction of the lens target is read, so that the lens can be automatically adjusted to the appropriate position, and the opposite movement of the lens is realized. Unlike the prior art, the lens is usually configured to follow the movement of the lens target for translation, that is, the lens moves in the same direction as the lens target. The opposite offset mechanism proposed in the present application can effectively avoid the problem of the player's field of view being blocked by the character's body, arms or climbing surface, so that the player can clearly see the relationship between the current character's climbing position and the surrounding environment, thereby focusing more on the climbing operation.
[0011] And the present application realizes the dynamic adjustment of the lens by continuously monitoring the change of the motion direction of the lens target and updating the lens offset parameter in time when the change of the motion direction exceeds the preset threshold. Not only does it ensure the stability and continuity of the lens during the character climbing process, but also makes the lens always in the best observation position, reduces the operation fatigue of the player caused by frequent manual adjustment of the viewing angle, greatly improves the convenience of operation and the immersion of the game.
[0012] Furthermore, the method can also automatically respond to various complex situations during the character climbing process. When the character encounters a sudden change in direction or needs to operate finely during the climbing process, the lens can quickly respond according to the real-time motion direction and adjust the lens offset parameter in time to provide accurate visual feedback for the player, helping the player to better plan the climbing path and avoid misoperation caused by the viewing angle, thereby improving the playability and smoothness of the game. BRIEF DESCRIPTION OF DRAWINGS
[0013] Figure 1 The present application is an exemplary network architecture; Figure 2 The present application is a top view of the lens target during the climbing process in one embodiment of the present application; Figure 3 The present application is a flowchart of one embodiment of the lens orientation control method; Figure 4 The present application is a principle block diagram of the lens orientation control device; Figure 5 The present application is a structure diagram of a lens orientation control device. DETAILED DESCRIPTION
[0014] The technical solution of the present application can be deployed in various network architectures, Figure 1An exemplary network architecture is shown. In this architecture, a game server 81 is connected to multiple player terminals 80 through a network, which are deployed with a computer program product implementing the camera orientation control method according to the present application, responsible for real-time processing of various events and interactions in the game when the computer program product is running. The game server 81 is responsible for receiving and processing the view control operation instructions sent by the player terminals, while monitoring the real-time state of the camera target in the game, obtaining the movement direction and initializing the camera control parameters when the camera target enters the climbing state, to support the automatic adjustment function of the camera. The player terminals 80 communicate with the game server through the network, receive game state information and send player operation instructions.
[0015] Please refer to Figure 2 , Figure 2 is a schematic diagram of the position relationship and direction adjustment of the camera target in the right climbing state in an embodiment of the present application, which shows the relationship between the camera target, the camera adjustment direction, the camera target orientation, the world coordinate system and the wall surface. Figure 2 The view angle represented in is a top-down view angle, when the camera target moves to the right on the wall surface, the adjustment direction of the camera is to rotate to the left, at this time the camera target orientation is to the right, thus it can be seen that when the camera target climbs to the right, the camera target orientation is consistent with the climbing direction of the camera target while the camera moves to the left, to ensure that the player obtains the best visual experience.
[0016] In terms of application scenarios, the technical solution of the present application is applicable to games that need to accurately control the camera orientation to improve the player experience. For example, in role-playing games (RPG) and open-world games, when the player climbs the wall, building or other vertical surface, the camera needs to be automatically adjusted to avoid occlusion, ensuring that the player can clearly see the climbing path and the surrounding environment. Through the technical solution of the present application, the game can dynamically adjust the camera position according to the real-time movement direction of the player character, ensuring that the camera is always at the best observation angle, reducing the frequency of manual adjustment of the view angle by the player, thereby improving the immersion and operation convenience of the game.
[0017] The camera target in the present application refers to the player character, and the camera refers to the virtual camera in the game. During the climbing process, the camera needs to be automatically adjusted in orientation according to the movement direction of the character, to provide a wider field of view. The game server will monitor the movement state and direction of the camera target in real time, calculate and update the camera position, to ensure that the player has a clear view when climbing. This dynamic camera adjustment mechanism not only optimizes the visual experience of the player, but also improves the smoothness of the game by reducing manual operations.
[0018] The lens offset direction is the direction in which the lens moves relative to the lens target. The lens offset direction is opposite to the movement direction of the lens target, so that the lens can be automatically adjusted to a position that is not blocked by the lens target or the climbing surface, thereby providing a more open view for the player. For example, when the lens target climbs to the right, the lens will offset to the left to ensure that the player can clearly see the climbing path and the surrounding environment. The lens offset amplitude refers to the distance that the lens moves relative to the lens target. The lens offset amplitude determines the distance between the lens and the lens target, which can be adjusted according to the specific game scene and the movement state of the lens target, to ensure that the lens does not move too close or too far from the lens target, so that the player can always maintain a good view of the game environment and effective control of the character. The target lens coordinate of the present application is the coordinate of the new position of the lens after moving, which is calculated according to the lens offset direction and the lens offset amplitude. In game development, this coordinate is used to determine the specific position of the lens in three-dimensional space, to ensure that the lens can smoothly and accurately move to the expected position to provide the best visual effect and game experience.
[0019] Referring to Figure 3 The lens orientation control method of the present application includes the following steps in some embodiments: Step S3100, determining that the current movement state of the lens target is a climbing state, and obtaining the real-time movement direction of the lens target.
[0020] During game running, when the lens target enters the game scene, the game engine initializes the lens control module, at which time the movement state of the lens target is determined. The lens target will usually be in a standing state when it enters the game scene, that is, the lens target will complete its state initialization in a certain standable area in the map scene. At this time, the game engine will continuously determine the movement state of the lens target. When the game detects that the lens target is in contact with the climbable surface and triggers the climbing action, the terminal will start the climbing state detection mechanism. Specifically, the physical collision body of the lens target can collide with the object marked as climbable, or the lens target inputs a climbing instruction near the climbable object. At this time, the game engine will switch to the climbing animation according to the animation state machine of the lens target, and initialize the lens control logic to start real-time monitoring of the movement state of the lens target. The movement state of the lens target can be distinguished in many ways, common methods include detecting player input, lens target animation state and physical engine feedback. For example, when the player presses the climbing key and the lens target is close to the climbable surface, the terminal will switch the movement state to the climbing state; the lens target animation system can trigger the climbing state by switching to the climbing animation; for example, the feedback of the collision detection physical engine of the lens target and the climbing surface can also be used to confirm the climbing state.
[0021] In this embodiment, the current climbing state of the camera target can be determined by detecting the interaction between the camera target and the climbable surface. For example, the game can detect whether the camera target collides with a wall marked as "climbable" or whether the camera target is in a specific climbing animation. The speed and direction of the camera target can also be used as a basis for judgment. If the camera target has a vertical speed and is in a climbing animation, it can also be determined to be in a climbing state. The real-time motion direction refers to the moving direction of the camera target in each frame during the climbing process. This direction can be determined by the orientation, speed vector, or animation parameters of the camera target. In the game, this direction is usually represented as a vector in three-dimensional space. For example, when the camera target climbs vertically upward, the motion direction can be a unit vector pointing upward (0, 1, 0). Alternatively, the motion direction can be determined by considering the local coordinate system of the camera target. For example, when the camera target moves horizontally to the right of itself, the motion direction vector can be set to (1, 0, 0).
[0022] In this embodiment, the obtained real-time motion direction data can be a three-dimensional vector indicating the moving direction of the camera target in the current frame. This three-dimensional vector can be an absolute direction in the world coordinate system or a direction relative to the local coordinate system of the camera target. In practical applications, the three-dimensional vector can be normalized to facilitate subsequent calculations. For example, if the camera target is climbing on an inclined surface, the real-time motion direction can take into account both the normal direction of the inclined surface and the moving direction of the camera target. The moving direction of the camera target can be determined based on the player's input and the current orientation of the camera target, while the normal direction of the inclined surface provides the inclination information of the inclined surface. By projecting the moving direction of the camera target onto the tangent plane of the inclined surface, the actual moving direction of the camera target on the inclined surface can be obtained, ensuring that the moving direction of the camera target matches the inclination angle of the inclined surface.
[0023] Assuming that the camera target moves upward on an inclined slope, the real-time motion direction not only includes the direction of the camera target's advance, but also needs to consider the inclination of the slope. The game engine will calculate a motion direction vector that takes into account both the inclination of the inclined surface and the moving intention of the camera target based on the normal vector of the inclined surface and the moving vector of the camera target. This vector will guide the actual moving path of the camera target on the inclined surface, while also affecting the orientation and position of the camera, to ensure that the player can clearly see the moving trajectory of the camera target and the surrounding environment. By using this real-time motion direction data to adjust the position and orientation of the camera, the camera can always be in the best observation position, and the movement of the camera target on the inclined surface and the response of the camera can seamlessly connect, providing the player with an intuitive and immersive gaming experience.
[0024] In step S3200, the lens offset parameter corresponding to the real-time movement direction is read, wherein the lens offset parameter includes a lens offset direction and a lens offset amplitude, and the lens offset direction is in an inverse relationship with the real-time movement direction.
[0025] In this embodiment, the lens offset direction is the direction in which the lens moves relative to the lens target, and the lens offset direction is opposite to the real-time movement direction of the lens target, thereby ensuring that the lens is not blocked by the lens target or the climbing surface, and providing a more open field of view for the player. For example, when the lens target climbs to the right, the lens will offset to the left; if the lens target climbs upward, the lens will offset downward, thereby ensuring that the player always has a clear view of the surrounding environment during the climbing process. The lens offset amplitude defines the distance that the lens moves in the opposite direction, and its function is to control the distance between the lens and the lens target to ensure that the player can have the best visual experience, because too large an offset amplitude can cause the lens to move too far away from the lens target, making it difficult for the player to focus on the main action; and too small an amplitude can not effectively avoid the blockage. Therefore, the lens offset amplitude needs to be dynamically adjusted according to the specific game scene and the movement speed of the lens target, for example, in a fast climbing scene of the lens target, the offset amplitude can be appropriately increased to maintain an open field of view; and in a fine operation scene, the amplitude can be reduced to maintain the stability of the lens.
[0026] In one embodiment, the inverse relationship between the lens offset direction and the real-time movement direction can be realized through vector operations. The real-time movement direction is usually represented as a three-dimensional vector, which defines the movement direction of the lens target in the current frame, and the lens offset direction is the inverse vector of the movement vector, that is, it is obtained by multiplying each component of the movement vector by -1. For example, if the real-time movement direction vector is (1, 0, 0) indicating that the lens target moves to the right, then the lens offset direction vector is (-1, 0, 0), indicating that the lens offsets to the left. In more complex cases, such as when the lens target climbs on an inclined surface, the real-time movement direction can include multiple directional components, in which case the lens offset direction needs to always maintain the basic principle of being opposite to the movement direction, and is determined by projecting the movement vector onto a specific plane or performing other vector operations.
[0027] In one embodiment, the offset calculation logic can be customized according to the specific needs of the game, and the lens offset parameter is calculated by combining the orientation, speed of the lens target, and the normal direction of the climbing surface, to achieve more fine lens control. When the lens target climbs on an inclined surface, the lens offset direction that conforms to the climbing logic and avoids blockage can be calculated by decomposing the movement vector into components in the tangent plane and the normal direction, thereby ensuring that the lens maintains the best observation angle in various complex scenarios.
[0028] Step S3300, calculating a target lens coordinate corresponding to the lens based on the lens offset direction and the lens offset magnitude, and driving the lens to move from a current coordinate to the target lens coordinate.
[0029] In this embodiment, the target lens coordinate is the coordinate of the new position to which the lens should move after moving, and the target lens coordinate is calculated based on at least the lens offset direction and the lens offset magnitude. These two parameters jointly determine the new position of the lens in the three-dimensional space. The calculation of the target lens coordinate includes vector operation and matrix transformation. First, the current position coordinate of the lens target is obtained, which is the position of the lens target in the world coordinate system. Then, the offset vector of the lens relative to the lens target is calculated according to the lens offset direction and the lens offset magnitude. The offset vector represents the direction and distance that the lens needs to move. Finally, the current position coordinate of the lens target is added to the offset vector to obtain the target lens coordinate. For example, if the current position of the lens target is P and the offset vector is V, the calculation method of the target lens coordinate P' is P' = P + V.
[0030] In one embodiment, the calculation of the target lens coordinate also needs to consider the orientation of the lens target and the normal direction of the climbing surface. By performing dot product and cross product operations on the offset vector and the normal vector of the climbing surface, the offset vector is projected onto a plane perpendicular to the climbing surface, so as to ensure that the lens will not pass through the climbing surface or appear unnatural offset.
[0031] In one embodiment, after determining the target lens coordinate, the lens can be driven to move smoothly from the current coordinate to the target lens coordinate by using an interpolation algorithm. Common interpolation methods include linear interpolation (Lerp), spherical linear interpolation (Slerp), and smooth step interpolation (SmoothStep). Linear interpolation is suitable for simple straight-line movement, while spherical linear interpolation is more suitable for rotation or arc-line movement. Smooth step interpolation can provide a more natural acceleration and deceleration effect. For example, when using linear interpolation, the position of the lens is updated frame by frame, and the movement amount of each frame is controlled by an interpolation factor. The interpolation factor usually varies between 0 and 1. As the interpolation factor increases, the lens gradually approaches the target coordinate. In actual settings, the more common setting is the spherical linear interpolation algorithm. When the lens rotates around the target, it can take the lens target as the center of the sphere and perform interpolation along the shortest path on the sphere in the three-dimensional space, thereby achieving a natural and efficient rotation or movement effect.
[0032] In one embodiment, the movement of the lens also needs to consider the maximum speed and acceleration limit to avoid unnatural abrupt movement. Therefore, speed and acceleration parameters can be introduced into the interpolation algorithm. For example, the difference vector between the current position of the lens and the target coordinate is calculated in each frame, and then the movement speed of the lens is adjusted according to the maximum speed and acceleration limit.
[0033] Step S3400, continuously monitor the change of the motion direction of the lens target, update the lens offset parameter based on the real-time motion direction of the lens target exceeding a preset change angle threshold, and drive the lens to move to the corresponding updated target lens coordinate based on the updated lens offset parameter until the lens target exits the climbing state.
[0034] The process of continuously monitoring the change of the motion direction of the lens target can be achieved by the physical system and event listening mechanism of the game engine. The game engine can periodically obtain the velocity vector or orientation change of the lens target at every frame or every preset number of frames, and compare the data of the current frame with the data of the previous frame. If the detected change angle exceeds the preset angle threshold, it is determined that the real-time motion direction of the lens target has changed significantly. At this time, the terminal reacquires the real-time motion direction of the lens target and updates the lens offset parameter accordingly. The updated lens offset parameter will be used to recalculate the target lens coordinate. For example, if the lens target changes from climbing horizontally to the right to climbing horizontally upward, the change of the real-time motion direction of the lens target will cause the lens offset direction to change from horizontally left to horizontally down, and the lens will also adjust the distance according to the lens offset amplitude to ensure that the lens does not block the lens target or the climbing path.
[0035] In an embodiment, the updated lens offset parameter is then applied to the lens control logic, and the terminal drives the lens to move smoothly to the new target lens coordinate through an interpolation algorithm, such as using a spherical linear interpolation algorithm to interpolate the rotation between the current lens coordinate and the newly calculated target lens coordinate, ensuring smooth transition of the lens during movement. The corresponding detection process will continue until the lens target exits the climbing state. The judgment conditions for the lens target to exit the climbing state can include the player releasing the climbing key, the lens target actively jumping off the climbable object, the lens target reaching the climbing end point such as the top of a wall or a platform, the lens target being impacted by an external impact or climbing to an unclimbable area causing the climb to be interrupted, the climbing action timing out without completion, or a game state switch, etc. The specific conditions can be adjusted according to the actual game play design. When the lens target exits the climbing state, the lens control logic will also be adjusted accordingly.
[0036] As can be seen from the above embodiments, by determining that the motion state of the lens target is a climbing state and obtaining the real-time motion direction, the embodiments can accurately identify the dynamic changes of the lens target in the game scene, provide accurate basis for subsequent lens adjustment, solve the problem that the lens cannot be automatically adjusted according to the motion state of the lens target in the traditional technology, and realize accurate identification and response to the climbing action of the lens target. By reading the lens offset parameters corresponding to the real-time motion direction, including the lens offset direction and amplitude, and calculating the target lens coordinates according to the lens offset parameters, the problem of visual field obstruction caused by the motion of the lens target is effectively avoided, and the visual experience of the player in the climbing process is improved. In addition, the embodiments can also continuously monitor the change of the motion direction of the lens target, and update the lens offset parameters in time when the preset angle threshold is exceeded, so as to ensure the smoothness and real-time performance of the lens movement, reduce the frequency of manual adjustment of the visual angle of the player, reduce the operation fatigue of the player, thereby obviously enhancing the game experience of the player, and making the automatic lens control process in the specific scene where the lens target is in the climbing state more intelligent and humanized.
[0037] On the basis of any embodiment of the method of the present application, the current motion state of the lens target is determined to be a climbing state, and the real-time motion direction of the lens target is obtained, including: Step S3110, the adsorption distance between the lens target and the preconfigured climbable surface is detected in real time, and when the adsorption distance is less than a preset climbing distance threshold, the lens target is adsorbed to the climbable surface.
[0038] In the present embodiment, the preconfigured climbable surface can be configured as a region specially designed and marked in the game scene for the lens target to climb. The climbable surface includes walls, rock walls, facades of buildings, etc. The game developer can define which surfaces can be climbed through a level editor or code configuration, and specify specific physical properties and labels for the climbable surface, so that the game engine can recognize and apply the corresponding climbing logic.
[0039] The adsorption distance is the maximum allowed distance between the lens target and the climbable surface, within which the lens target can interact with the surface and enter the climbing state. The detection of the adsorption distance is usually realized through collision detection or ray detection of the physics engine. For example, the game engine can periodically emit rays in various directions from the position of the lens target. If the rays hit the surface marked as climbable within a certain distance, it is considered that the lens target is within the adsorption distance. In addition, a trigger of a sphere or capsule can be used to determine whether the lens target is within the adsorption distance. When the collision body corresponding to the capsule shape of the lens target enters a certain surface range of the climbable surface, it is determined that the lens target has entered the adsorption distance. The climbing distance threshold can be set to a specific value according to actual conditions, which is used to determine whether the lens target is close enough to the climbable surface to start the climbing action. The climbing distance threshold can be set based on the requirements of game design and the size of the character model, to ensure that the lens target can only interact with the surface within a reasonable distance, avoiding the lens target entering the climbing state when it is far away from the wall.
[0040] When the distance between the lens target and the climbable surface is less than the climbing distance threshold, the lens target is adsorbed on the climbable surface, which means that the lens target has entered the climbing state, and its movement logic will follow the climbing-related physical rules and animations. In the climbing state, the movement of the lens target will be limited by the climbable surface, such as being able to move only along the surface and not being able to detach from the surface. The game engine will adjust the position and angle of the lens according to the adsorption state and climbing direction of the lens target, to ensure that the player can clearly see the climbing path and the surrounding environment. When the lens target is adsorbed on the wall and climbs upward, the lens will automatically adjust to a suitable position, which may be shifted left or right, to avoid being blocked by the lens target or the wall, while maintaining a clear view of the climbing path.
[0041] In an embodiment, when the distance between the lens target and the climbable surface is less than the climbing distance threshold, it can be determined whether the current lens target is in the climbable state, and an interface component corresponding to the climbing state is provided to the player. Only when the instruction information for entering the climbing state is further received through the feedback of the interface component, the lens target will enter the climbing state.
[0042] In step S3120, the current climbing adsorption point of the lens target is determined, and the relative displacement vector of the lens target on the climbable surface is calculated based on the climbing adsorption point. The direction of the relative displacement vector is taken as the real-time movement direction of the lens target.
[0043] The climbing adsorption point is a specific adsorption position of the camera target on the climbable surface, which can be determined based on the collision detection result or the ray detection result of the camera target and the climbable surface. When the camera target approaches the wall surface, the game engine determines the climbing adsorption point by detecting the contact point between the collision body of the camera target and the wall surface. The climbing adsorption point can become the anchor point of the camera target during the climbing process, which is used for subsequent displacement calculation and camera adjustment. The relative displacement vector represents the displacement direction and distance of the camera target relative to the climbable surface or the previous position, which is used to determine the movement direction and position change of the camera target during the climbing process. In the present embodiment, the relative displacement vector can be used to calculate the real-time movement direction of the camera target, so as to determine the offset direction of the camera to reflect the specific moving path and direction of the camera target on the climbable surface. The calculation of the relative displacement vector is based on the movement of the camera target on the climbable surface. By comparing the climbing adsorption point positions of the camera target in the current frame and the previous frame, the relative displacement vector can be calculated, which contains the direction and distance information of the movement of the camera target on the climbable surface.
[0044] The direction component of the relative displacement vector can be used to determine the real-time movement direction of the camera target. For example, the direction of the relative displacement vector can be set as the real-time movement direction of the camera target. If the X-axis component of the relative displacement vector in the world coordinate system is positive, the Y-axis component is zero, and the Z-axis component is negative, the real-time movement direction is to move to the right and downward. The direction information corresponding to the relative displacement vector can also be used to update the camera offset parameters, so as to ensure that the camera can dynamically adjust the position according to the movement of the camera target, thereby avoiding occlusion and maintaining the best observation angle.
[0045] Through the above embodiment, the present embodiment can provide a precise adsorption and movement direction determination mechanism for the climbing process of the camera target. By detecting the adsorption distance between the camera target and the climbable surface and adsorbing the camera target to the surface when the distance is less than the preset climbing distance threshold, it is ensured that the camera target can be stably attached to the climbable surface, which provides a basis for subsequent climbing actions. Not only does it improve the realism of the game, but it also provides a clear reference point for the automatic adjustment of the camera. Moreover, by determining the current climbing adsorption point of the camera target and calculating the relative displacement vector based thereon, the real-time movement direction is determined, which realizes the accurate capture and representation of the movement state of the camera target. By taking the direction of the relative displacement vector as the real-time movement direction, the present embodiment can accurately identify the movement trend of the camera target, thereby realizing the automatic adjustment of the camera and ensuring that the player has a clear view and a smooth game experience during the climbing process.
[0046] On the basis of any embodiment of the method of the present application, the camera offset parameters corresponding to the real-time movement direction are read, including: Step S3210, based on the real-time motion direction, searching for the initial offset direction and offset amplitude of the lens in a preset lens offset parameter table.
[0047] In this embodiment, the lens offset parameter table can be set as a data structure for storing lens offset parameters corresponding to different motion directions, including the offset direction and offset amplitude of the lens. The lens offset parameter table is loaded into the memory at the initialization of the game, so that it can be quickly queried and applied during the game running. The design of the lens offset parameter table can be based on various methods. One method is to divide the motion direction into multiple preset direction intervals and define corresponding offset parameters for each interval. For example, the 360-degree motion direction can be divided into eight main direction intervals: up, down, left, right, left up, right up, left down, and right down, each corresponding to a set of offset parameters. Another method is to use continuous direction mapping to calculate the offset parameters corresponding to any motion direction by interpolation. In the lens offset parameter table, the key direction points and their corresponding offset parameters are stored, and then during the running, the relative positions of the real-time motion direction and the key direction points are calculated by interpolation, thereby providing smoother lens transition effects.
[0048] The game engine can use vector operations to find the initial offset direction and offset amplitude based on the real-time motion direction. The real-time motion direction can be represented as a unit vector. By calculating the dot product of the real-time motion direction vector and each direction vector in the lens offset parameter table, the included angle between them is determined, and then the offset parameter corresponding to the direction with the smallest included angle with the real-time motion direction is selected as the initial offset parameter, thereby quickly and accurately finding the closest offset parameter. Meanwhile, the real-time motion direction can also be represented as a direction angle. The precise offset parameter between adjacent key direction points is calculated by linear interpolation or spherical linear interpolation. If the real-time motion direction is between two key direction points, the terminal calculates the weight combination of the offset parameter according to the proportion of the direction angle, thereby realizing smooth direction transition.
[0049] Step S3220, calculating the lens offset direction according to the initial offset direction and a preset lens offset compensation algorithm, and dynamically adjusting the offset amplitude based on the velocity vector of the real-time motion direction to obtain an adjusted lens offset amplitude.
[0050] The lens offset compensation algorithm used in this embodiment has the ability to correct the deviation between the initial offset direction and the ideal observation direction. The weighted average algorithm can be selected to combine the initial offset direction, the orientation of the lens target, and the normal direction of the climbing surface, and by assigning weights to each direction component, the final lens offset direction is calculated, which can be specifically represented as: Lens offset direction = × Initial offset direction + × Lens target orientation + × Normal direction wherein the lens offset direction, the initial offset direction, the lens target orientation and the normal direction are unit vectors, , , are weight coefficients, and the sum of each weight coefficient is set to 1.
[0051] In an embodiment, in order to achieve a more natural lens movement effect, a prediction algorithm based on deep learning can be used. By analyzing a large number of viewing habit samples and operation data samples, a deep learning model is trained to predict the best lens offset direction. The selection and training of the model can be performed according to actual conditions, and will not be described in detail here.
[0052] In the present embodiment, the velocity vector represents the direction and distance of the lens target movement in unit time, which can reflect the speed and direction of the lens target movement. In the present embodiment, the velocity vector is used to dynamically adjust the offset amplitude of the lens when calculating the offset amplitude. When the lens target moves at a faster speed, a larger offset amplitude can be set to ensure that the player has enough field of view to observe the surrounding environment and obstacles. When the lens target moves at a slower speed, the offset amplitude can be appropriately reduced to make the lens more stable and accurate in following the lens target. Thus, the velocity vector is used to dynamically adjust the offset amplitude to ensure that the lens can automatically adapt to the movement speed of the lens target. The offset amplitude is set to be scaled based on the size of the velocity vector, which can be represented as: Adjusted lens offset amplitude = Offset amplitude × ƒ (Velocity vector) wherein the lens offset amplitude and the offset amplitude are length units (m) set, and ƒ is a linear function or an exponential function used to adjust the offset amplitude according to the size of the velocity vector.
[0053] In an embodiment, the offset amplitude is adjusted by the direction of the velocity vector to ensure that the lens movement in different directions has appropriate sensitivity. The velocity vector is decomposed into different directions, and the offset amplitude is adjusted according to the size of the component in each direction. Thus, when the lens target performs complex motion, the terminal can also achieve more precise lens control.
[0054] The above embodiments improve the accuracy and adaptability of lens control through fine parameter adjustment and algorithm application. By searching for the initial offset direction and offset amplitude in the preset lens offset parameter table based on the real-time motion direction, using the data structure of the lens offset parameter table, the embodiment realizes quick and accurate determination of the initial position of the lens. By combining the initial offset direction with the lens offset compensation algorithm to calculate the lens offset direction and dynamically adjusting the offset amplitude according to the speed vector of the real-time motion direction, the lens can respond to the actual motion state of the lens target in real time, and the naturalness and smoothness of lens movement are effectively improved, thereby enhancing the visual experience of players in the game and making the lens control better adapt to the adjustment requirements in the climbing scene.
[0055] On the basis of any embodiment of the method of the application, the target lens coordinate corresponding to the lens is calculated based on the lens offset direction and the lens offset amplitude, and the lens is driven to move from the current coordinate to the target lens coordinate, including: In step S3310, the current position coordinate of the lens target is obtained, and the target lens coordinate is calculated based on the lens offset parameter and the preset lens offset model.
[0056] In this embodiment, the current position coordinate of the lens target is provided by the game engine, which represents the position of the lens target in the world coordinate system. If the lens target is located at the point (5, 3, 2) in the world coordinate system, it means that its coordinates in the X, Y, and Z axes are 5, 3, and 2, respectively.
[0057] The lens offset parameter includes the lens offset direction and the lens offset amplitude, which together define the movement of the lens relative to the lens target. When the lens offset direction is (-1, 0, 0), it means that the lens moves in the negative direction of the X axis, which can be considered as the lens target moving a certain distance horizontally to the left. The lens offset model is set as a preset rule algorithm, which is used to calculate the target position of the lens according to the lens offset parameter. It defines how to apply the lens offset direction and the offset amplitude to the current position coordinate of the lens target to determine the new position of the lens. For example, the lens offset model can specify multiplying the unit vector of the lens offset direction by the offset amplitude, and then adding the result vector to the current position coordinate of the lens target to obtain the target lens coordinate.
[0058] In one embodiment, the calculation of the target lens coordinate can be realized by vector addition operation. The target lens coordinate is equal to the current position coordinate of the lens target plus the lens offset vector. If the current position of the lens target is (5, 3, 2), the lens offset vector is (-1, 0, 0) and the amplitude is 2 meters, then the target lens coordinate is (5-1*2, 3, 2) = (3, 3, 2).
[0059] In another embodiment, the lens shift model can also handle the case of lens rotation or non-linear transformation, and the target lens coordinates can be calculated by using quaternion or matrix operation. If the lens needs to rotate around the lens target by a certain angle, the lens position can be updated by using a rotation matrix or quaternion, and the distance can be adjusted by combining the shift amplitude. The rotation matrix can be set as a 3x3 orthogonal matrix, which is used to represent the rotation transformation in three-dimensional space. Each rotation matrix corresponds to a specific rotation angle and rotation axis. By multiplying the current position vector of the lens with the matrix, a new position vector can be obtained. Quaternion can also efficiently represent the rotation of the lens in three-dimensional space. It can avoid gimbal lock and has high computational efficiency. By multiplying the quaternion with the vector, the rotated position vector can be calculated. Thus, the lens shift parameters corresponding to the position vector can be applied to the current position coordinates of the lens target.
[0060] In an embodiment, the lens shift model considers the orientation of the lens target or the normal direction of the surface it climbs. When the lens target climbs along an inclined surface, the shift vector is projected onto the tangent plane of the inclined surface to adjust the shift direction, so as to ensure that the lens does not pass through the surface or have unnatural shift.
[0061] In step S3320, a smooth interpolation algorithm is used to generate a transition path from the current position coordinates to the target lens coordinates, to drive the lens to move from the current coordinates to the target lens coordinates along the transition path. The transition path can be a circular path around the lens target or other paths.
[0062] In this embodiment, the lens moves smoothly along the transition path by using a smooth interpolation algorithm. The smooth interpolation algorithm can generate a series of intermediate position points based on the current lens position and the calculated target lens coordinates, thereby forming a smooth transition path. The interpolation algorithms used include but are not limited to linear interpolation, spherical linear interpolation, and Bezier curve interpolation.
[0063] In an embodiment, linear interpolation is used to insert intermediate points between the current coordinates and the target coordinates at a fixed step size, to drive the lens to move along a straight line.
[0064] In another embodiment, spherical linear interpolation is used to handle the rotation or arc path, so that the lens can move along a circular surface trajectory with a fixed distance from the center point of the lens target, to achieve a more natural transition effect while keeping the orientation of the lens target consistent with the orientation of the lens.
[0065] In another embodiment, Bezier curve interpolation is used to provide non-linear path control to drive the lens to move in a special way. This will not be described in detail here.
[0066] When generating the transition path, the current position of the lens and the position of the target lens coordinate need to be determined first, and then the intermediate coordinate points between the two endpoints are calculated by means of a selected interpolation algorithm. For example, by gradually adjusting the current position through an interpolation factor changing from 0 to 1, the lens can be smoothly transitioned to the corresponding target position. The transition path can also be designed as a circular path or other custom path around the lens target. For a circular path, the radius and rotation angle are defined with the lens target as the center, and the position of the lens on the circumference is calculated using trigonometric functions. As the angle parameter continuously changes, the lens will move at a constant speed along the circular path, achieving the effect of observing the view around the lens target.
[0067] In an embodiment, for an elliptical or spiral path, the target lens coordinates at each time can be calculated according to the mathematical definition of the corresponding path. Ultimately, as long as the path setting can ensure the smoothness of the lens movement, it can be freely set at the beginning of the specific game to enhance the visual performance of the game through flexible path design and provide an immersive experience for the player.
[0068] The synergy of the above embodiments ensures the smoothness and flexibility of the lens movement process. By obtaining the current position coordinates of the lens target and combining the lens offset parameters and the lens offset model to calculate the target lens coordinates, a foundation is provided for the precise positioning of the lens, ensuring that the direction and distance of the lens movement meet the requirements of game design and providing a clear starting point and endpoint for further path planning. Moreover, this embodiment uses a smooth interpolation algorithm to generate a transition path from the current position coordinates to the target lens coordinates, enabling the lens to move smoothly along the predetermined path and avoiding abrupt changes in the lens position, thereby enhancing the visual experience of the player. At the same time, the transition path can be designed as a circular path or other complex path around the lens target, thereby increasing the flexibility and diversity of game lens control and better adapting to different game scenarios and player needs.
[0069] On the basis of any embodiment of the method of the present application, driving the lens to move from the current coordinates to the target lens coordinates further comprises: Step S3410, non-linearly mapping the lens offset amplitude and the real-time motion speed of the lens target to obtain a corresponding dynamic damping coefficient.
[0070] In this embodiment, in order to realize the smooth movement of the lens, the lens offset amplitude is nonlinearly mapped with the real-time movement speed of the lens target to obtain the corresponding dynamic damping coefficient. Nonlinear mapping is a technique that converts input values to output values through a nonlinear function, which can be used to adjust the movement characteristics of the lens to make it more natural and smooth. Nonlinear mapping can be implemented through various mathematical functions, including exponential function, logarithmic function, power function, etc., to convert the input values corresponding to the lens offset amplitude and the real-time movement speed of the lens target into nonlinear dynamic damping coefficient output values through corresponding nonlinear mapping. The dynamic damping coefficient can be used to control the acceleration and deceleration of the lens movement, so that the lens can smoothly follow the target at high speed and accurately respond to the player's control at low speed. The dynamic damping coefficient obtained through nonlinear mapping is used to adjust the movement equation of the lens, and in the physical simulation of lens movement, the damping coefficient is applied to the acceleration calculation of the lens, thereby realizing smooth lens movement, which can effectively reduce the abruptness in lens movement and improve the player's visual experience.
[0071] In an embodiment, the nonlinear mapping can also be combined with the current acceleration of the lens, the input force of the player, etc., to realize more complex lens control logic. When the lens target accelerates during climbing, the damping coefficient is increased to make the lens follow more smoothly; and when the lens target performs subtle movement operations, the damping coefficient is reduced to improve the response speed of the lens.
[0072] Step S3420, smoothing filtering the lens orientation of the lens based on the dynamic damping coefficient, wherein the filtering adopts a velocity-adaptive fourth-order Bezier curve interpolation.
[0073] Smoothing filtering the lens orientation based on the dynamic damping coefficient is an effective technical means for realizing the natural transition of lens movement. This process usually involves velocity-adaptive fourth-order Bezier curve interpolation to ensure smooth movement of the lens at different speeds.
[0074] In this embodiment, the dynamic damping coefficient can be calculated through nonlinear mapping according to the lens offset amplitude and the real-time motion speed of the lens target. The dynamic damping coefficient can dynamically adjust the motion damping effect of the lens, so that the lens remains stable at high speed and responds sensitively at low speed. When the lens target moves quickly, the dynamic damping coefficient increases, thereby increasing the damping of the lens motion and making it smoothly follow the target. When the lens target performs fine operations, the dynamic damping coefficient decreases, thereby improving the response speed of the lens. The four-order Bezier curve interpolation can generate a smooth and natural transition path, which is defined by five control points, including the starting point, the ending point and three intermediate control points. These intermediate control points can be static or dynamically adjusted to adapt to the lens motion requirements. By adjusting the positions of these control points, the shape of the curve can be controlled, thereby realizing complex motion trajectories. The speed-adaptive four-order Bezier curve interpolation means that the parameters of the curve are adjusted according to the real-time motion speed of the lens target. When the speed of the lens target increases, the control points of the Bezier curve can be adjusted accordingly to make the curve smoother to adapt to high-speed motion. Conversely, when the speed decreases, the control points can be adjusted more closely to achieve more accurate control.
[0075] In one embodiment, the dynamic damping coefficient is first calculated according to the real-time motion speed of the lens target and the lens offset amplitude, then the parameters of the four-order Bezier curve interpolation, such as the positions or weights of the control points, are adjusted using the dynamic damping coefficient, and then the target orientation of the lens in each frame is calculated through the Bezier curve interpolation algorithm. Finally, the actual orientation of the lens is gradually adjusted to the target orientation, thereby realizing a smooth filtering effect.
[0076] The above embodiments of the present application can improve the smoothness and adaptability of lens motion through dynamic damping coefficient and interpolation technology. The dynamic damping coefficient can be accurately calculated by nonlinear mapping of the lens offset amplitude and the real-time motion speed of the lens target, so that the damping effect of the lens is adjusted in real time according to the motion state of the lens target, ensuring that the lens remains stable at high speed and responds sensitively at low speed. Meanwhile, the embodiments utilize speed-adaptive four-order Bezier curve interpolation to smoothly filter the lens orientation, further enhancing the smoothness of lens motion. The four-order Bezier curve interpolation can adapt to the lens motion requirements at different speeds by dynamically adjusting the control points, effectively reducing the jitter and abruptness in lens motion. The embodiments not only improve the accuracy of lens control, but also optimize the visual experience of players, making the lens motion more natural and immersive, thereby improving the overall quality of the game.
[0077] On the basis of any embodiment of the method of the present application, the change in the movement direction of the lens target is continuously monitored, the lens offset parameter is updated based on the real-time movement direction of the lens target exceeding a preset change angle threshold, and the lens is driven to move to the updated target lens coordinate based on the updated lens offset parameter until the lens target exits the climbing state, comprising: Step S3510, the change in the movement direction of the lens target is monitored in real time, and the included angle in degrees between the current movement direction of the lens target and the movement direction at the previous monitoring time is obtained.
[0078] In this embodiment, during game running, the included angle in degrees between the current movement direction of the lens target and the direction of the previous frame is continuously calculated and recorded, and the change in the movement direction of the lens target is monitored in real time. The monitoring task is triggered by the main loop at the beginning of each frame. First, the speed vector of the current frame is read, and the normalized current unit direction is obtained. Then, the unit direction of the previous frame in the cache is taken out. The cosine value is obtained by dot product of the two, and then the corresponding included angle in degrees is obtained by using the inverse cosine function. The cosine value can also be directly compared with the cosine value corresponding to the preset angle threshold without using the inverse cosine function.
[0079] The current movement direction of the lens target can be obtained from multiple sources, including the linear velocity vector returned by the physical engine, the root motion vector provided by the animation system, or the target movement vector generated by the player input. The movement direction at the previous monitoring time is cached in the same structure, so that the read and write operations do not require additional memory overhead. The calculation result of the included angle in degrees is written into the same cache for subsequent steps to determine whether the lens offset parameter update needs to be triggered.
[0080] Step S3520, if the included angle in degrees exceeds the preset change angle threshold, the real-time movement direction of the lens target is reacquired, and the lens offset parameter corresponding to the updated real-time movement direction is searched in the lens offset parameter table.
[0081] The change angle threshold can be set as a fixed angle value stored in the configuration table, for example, fifteen degrees or thirty degrees, which is used to determine whether the change in the direction of the lens target is sufficient to trigger recalculation. When the included angle in degrees between the real-time direction and the direction of the previous frame exceeds the threshold, the terminal determines that the direction has changed significantly and immediately executes the subsequent logic.
[0082] In this embodiment, the lens shift parameter table is a mapping table with direction as key and parameter as value. Each record contains three data: direction key, lens shift direction vector and lens shift amplitude value. The direction key can be a discrete angle interval or a unit vector. The shift direction vector defines the reverse shift direction of the lens relative to the lens target. The shift amplitude gives the distance of lens movement. The lens shift parameter table is loaded into the memory once at the start of the game to support constant time query. After the real-time motion direction is reacquired, the terminal matches the real-time motion direction with the direction keys in the table. After successful matching, the corresponding shift direction vector and shift amplitude value are directly read to form a new lens shift parameter, which is used for subsequent target lens coordinate calculation.
[0083] Step S3530, based on the updated lens shift parameter, the current target lens coordinate is obtained, and the lens is driven to move to the coordinate point corresponding to the current target lens coordinate.
[0084] The updated lens shift parameter is composed of a shift direction vector and a shift amplitude value, which are directly used to calculate the current target lens coordinate. The shift direction vector is a unit vector, and the shift amplitude is a scalar distance. Their product is a shift vector. The terminal first reads the current world coordinate vector of the lens target, adds the vector to the shift vector, and the result is the current target lens coordinate. If the lens shift model requires a circular path, an additional step is performed. The additional step takes the lens target as the center and the shift amplitude as the radius to get the target lens coordinate on the circular path along the shift direction vector. After the target lens coordinate is calculated, the terminal calls the interpolation function to smoothly transition the current lens coordinate to the current target lens coordinate. The interpolation factor is determined by the frame interval and the preset transition time, ensuring that the lens reaches the target point within the current frame.
[0085] The above embodiments of the present application provide a continuous, sensitive and smooth closed-loop mechanism for lens control. By monitoring the direction change of the lens target in real time and calculating the included angle, each direction switch can be accurately captured, avoiding the lag or false triggering caused by improper threshold setting in traditional techniques. Once the included angle exceeds the preset threshold, the terminal immediately reacquires the real-time motion direction and quickly locates the corresponding offset direction and amplitude in the lens offset parameter table. Thus, the computational load is compressed to a constant level, ensuring real-time response in high frame rate scenarios. The updated offset parameters in the present embodiment are directly used to calculate the current target lens coordinates, combined with the circular path or linear interpolation, so that the lens completes smooth transition in a very short time, eliminating abrupt data jumps and maintaining synchronization with the lens target motion. The lens movement process does not require manual intervention by the player, significantly reducing the player's operation fatigue. Meanwhile, through further filtering by the dynamic damping coefficient and the fourth-order Bezier curve, the lens motion is stable during high-speed sprints and sensitive during low-speed fine tuning, ultimately providing an always open, unobstructed and continuous field of view experience for the climbing scenario.
[0086] On the basis of any embodiment of the method of the present application, before the step of determining that the current motion state of the lens target is a climbing state, the method further comprises: Step S3610, performing multi-ray collision detection on the three-dimensional bounding box corresponding to the lens target, wherein the center of gravity of the multi-ray bounding box extends to at least six axes.
[0087] The three-dimensional bounding box is a simplified geometric shell of the lens target in the game world, usually taking an axis-aligned cube or a minimum bounding box, and its center of gravity is the geometric center point. The multi-ray collision detection starts from the center of gravity and emits unit-length rays along the positive X, negative X, positive Y, negative Y, positive Z and negative Z axes. Each ray performs intersection judgment with the climbable surface in the scene: if the included angle between the ray and the surface normal is less than a preset threshold and the length of the ray is less than the maximum climbing distance threshold, it is determined that the lens target has entered the climbing range. The length of the ray can be fixed or dynamically scaled according to the current speed of the lens target; the number of rays can be extended to eight or twelve to improve detection accuracy, and the detection result returns a Boolean value within a single frame, which is used to immediately trigger the climbing state switching and subsequent lens parameter updating.
[0088] Step S3620, when the included angle between one of the rays starting from the center of gravity of the multi-ray bounding box and the model configuration normal of the predefined climbable surface is less than a preset climbing angle threshold, and the length of the ray is less than a preset climbing distance threshold, it is determined that the lens target is currently in a climbing state, and the real-time motion direction of the lens target is monitored.
[0089] When any one of the rays shot from the center of the three-dimensional bounding box forms an angle with the model configuration normal of the climbable surface that is less than the preset climb angle threshold, and the length of the ray is less than the preset climb distance threshold, the terminal immediately marks the lens target as a climb state, and simultaneously continuously monitors the real-time motion direction thereof. The preset climb angle threshold and the climb distance threshold are stored in the game configuration file, the angle threshold range can be configured to fifteen degrees to thirty degrees, and the distance threshold is determined according to the character model height multiplied by a proportionality coefficient, for example, the threshold is set to be 0.8 times the height of the character.
[0090] The model configuration normal of the climbable surface is part of the climbable surface material attribute, which is automatically generated by the art tool when importing the model and is loaded together with the game data. For dynamically generated surfaces, the normal is obtained in real time by runtime geometry calculation, and the ray length is returned by the ray projection function of the engine, the function parameters including the starting point, direction vector and maximum length, and the return value containing the hit point coordinates and normal if it hits the surface. When the angle between the pre-defined model configuration normal of the climbable surface is less than the preset climb angle threshold, and the length of the ray is less than the preset climb distance threshold, the value of the climb state Boolean will be true, and then the speed vector is continuously read and normalized in the physical update stage to obtain the real-time motion direction for subsequent lens offset calculation.
[0091] Through the synergistic effect of the above embodiments, the application completes the determination of the climb state in a very short time through multi-ray detection with the center of gravity as the starting point, and synchronously locks the real-time motion direction. The rays are emitted along six axes, and the angle and distance with the normal of the climbable surface are double-filtered to ensure that the climb logic is triggered only when the lens target is really close to and facing the climb surface, avoiding false triggering. The threshold and distance value come from the configuration file, which can be adjusted with the level without updating the code, improving iteration efficiency. After successful determination, the direction monitoring is immediately started, the speed vector is normalized in real time in the physical update stage, and the subsequent lens offset calculation directly takes it, without the need for secondary sampling. The whole process can be completed in a short time, not only reducing the operation delay, but also ensuring the immediacy and stability of the lens response during the climb process, thereby improving the visual fluency of the player.
[0092] Please refer to Figure 4According to an aspect of the present application, a lens orientation control device is provided, comprising a state determination module 4100, a parameter reading module 4200, a lens moving module 4300 and a displacement updating module 4400. The touch response module 4100 is configured to determine that the current motion state of the lens target is a climbing state, and obtain a real-time motion direction of the lens target. The parameter reading module 4200 is configured to read a lens offset parameter corresponding to the real-time motion direction, wherein the lens offset parameter comprises a lens offset direction and a lens offset amplitude, and the lens offset direction is in an inverse relationship with the real-time motion direction. The lens moving module 4300 is configured to calculate a target lens coordinate of the lens based on the lens offset direction and the lens offset amplitude, and drive the lens to move from a current coordinate to the target lens coordinate. The displacement updating module 4400 is configured to continuously monitor a change in the motion direction of the lens target, update the lens offset parameter based on a real-time motion direction in which the lens target exceeds a preset change angle threshold, and drive the lens to move to a target lens coordinate updated based on the updated lens offset parameter until the lens target exits the climbing state.
[0093] On the basis of any embodiment of the device of the present application, the state determination module 4100 comprises an adsorption detection module configured to detect a adsorption distance between the lens target and a preconfigured climbable surface in real time, and adsorb the lens target to the climbable surface when the adsorption distance is less than a preset climbing distance threshold. An adsorption determination module is configured to determine a climbing adsorption point of the lens target, calculate a relative displacement vector of the lens target on the climbable surface based on the climbing adsorption point, and take a direction of the relative displacement vector as a real-time motion direction of the lens target.
[0094] On the basis of any embodiment of the device of the present application, the parameter reading module 4200 comprises a parameter searching module configured to search for an initial offset direction and an offset amplitude of the lens in a preset lens offset parameter table based on the real-time motion direction. A direction calculation module is configured to calculate the lens offset direction according to the initial offset direction and a preset lens offset compensation algorithm, and dynamically adjust the offset amplitude based on a velocity vector of the real-time motion direction to obtain an adjusted lens offset amplitude.
[0095] On the basis of any embodiment of the device of the present application, the lens moving module 4300 comprises: a coordinate acquisition module configured to acquire a current position coordinate of the lens target, and calculate the target lens coordinate based on the lens offset parameter and a preset lens offset model; a path generation module configured to generate a transition path from the current position coordinate to the target lens coordinate by using a smooth interpolation algorithm, so as to drive the lens to move along the transition path from the current coordinate to the target lens coordinate, wherein the transition path is a circular path or other path around the lens target.
[0096] On the basis of any embodiment of the device of the present application, the lens moving module 4300 further comprises: a coefficient mapping module configured to nonlinearly map the lens offset amplitude and a real-time motion speed of the lens target, to obtain a corresponding dynamic damping coefficient; and a coefficient filtering module configured to perform smooth filtering on a lens orientation of the lens based on the dynamic damping coefficient, wherein the filtering uses a fourth-order Bezier curve interpolation with speed adaptation.
[0097] On the basis of any embodiment of the device of the present application, the displacement updating module 4400 comprises: an included angle acquisition module configured to monitor a motion direction change of the lens target in real time, and acquire an included angle degree between a current motion direction of the lens target and a motion direction at a previous monitoring time; a parameter updating module configured to, if the included angle degree exceeds a preset change angle threshold, reacquire a real-time motion direction of the lens target, and find and update a lens offset parameter corresponding to the updated real-time motion direction in the lens offset parameter table; and a lens updating module configured to calculate a current target lens coordinate based on the updated lens offset parameter, and drive the lens to move to a coordinate point corresponding to the current target lens coordinate.
[0098] On the basis of any embodiment of the device of the present application, further comprising: a collision detection module configured to perform multi-ray collision detection on a three-dimensional bounding box corresponding to the lens target, wherein a center of gravity of the multi-ray bounding box extends to at least six axial directions; and a climbing determination module configured to, when an included angle between a ray starting from the center of gravity of the multi-ray bounding box and a model configuration normal of a predefined climbable surface is less than a preset climb angle threshold, and a length of the ray is less than a preset climb distance threshold, determine that the lens target is currently in a climbing state, and correspondingly monitor a real-time motion direction of the lens target.
[0099] Another embodiment of the present application also provides a lens orientation control device. As shown in FIG. 13, the lens orientation control device comprises a lens moving module 1300, a displacement updating module 1400, a collision detection module 1500, and a climbing determination module 1600. Figure 5As shown, the lens orientation control device is a schematic diagram of the internal structure of the lens orientation control device. The lens orientation control device includes a processor, a computer readable storage medium, a memory and a network interface connected through a system bus. Among them, the computer readable non-volatile readable storage medium of the lens orientation control device stores an operating system, a database and computer readable instructions, the database can store information sequences, and the computer readable instructions are executed by the processor to enable the processor to realize a lens orientation control method.
[0100] The processor of the lens orientation control device is used to provide computing and control capabilities to support the operation of the entire lens orientation control device. The memory of the lens orientation control device can store computer readable instructions, which, when executed by the processor, can cause the processor to execute the lens orientation control method of the present application. The network interface of the lens orientation control device is used to connect and communicate with the terminal.
[0101] Those skilled in the art can understand that, Figure 5 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the lens orientation control device to which the scheme of the present application is applied. The specific lens orientation control device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0102] The processor in the embodiment is used to execute the specific functions of each module in Figure 4 The memory stores the program codes and various data required to execute the above-mentioned modules or sub-modules. The network interface is used to realize data transmission between the user terminal or the server. The non-volatile readable storage medium in the embodiment of the present application stores the program codes and data required to execute all modules in the lens orientation control device of the present application. The server can call the program codes and data of the server to execute the functions of all modules.
[0103] The present application also provides a non-volatile readable storage medium storing computer readable instructions, which, when executed by one or more processors, causes the one or more processors to execute the steps of the lens orientation control method of any embodiment of the present application.
[0104] The present application also provides a computer program product, including computer programs / instructions, which, when executed by one or more processors, realize the steps of the method described in any embodiment of the present application.
[0105] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be completed by a computer program instructing relevant hardware, and the computer program can be stored in a non-volatile readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiments of the method. The storage medium can be a computer readable storage medium such as a magnetic disc, an optical disc, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
Claims
1. A lens orientation control method, characterized in that, include: The current motion state of the target in the camera is determined to be climbing, and the real-time motion direction of the target in the camera is obtained; Read the lens offset parameters corresponding to the real-time motion direction, wherein the lens offset parameters include the lens offset direction and the lens offset magnitude, and the lens offset direction is inversely related to the real-time motion direction; Calculate the target lens coordinates corresponding to the lens based on the lens offset direction and the lens offset magnitude, and drive the lens to move from the current coordinates to the target lens coordinates; The movement direction of the lens target is continuously monitored. The lens offset parameter is updated based on the real-time movement direction of the lens target exceeding a preset change angle threshold. The lens is then driven to move to the corresponding updated target lens coordinates based on the updated lens offset parameter until the lens target exits the climbing state.
2. The lens orientation control method according to claim 1, characterized in that, Determining the current motion state of the target in the camera lens as a climbing state and obtaining the real-time motion direction of the target in the camera lens includes: The adsorption distance between the lens target and the pre-configured climbable surface is detected in real time. When the adsorption distance is less than the preset climbing distance threshold, the lens target is adsorbed onto the climbable surface. Determine the current climbing and adsorption point of the lens target, calculate the relative displacement vector of the lens target on the climbable surface based on the climbing and adsorption point, and take the direction of the relative displacement vector as the real-time movement direction of the lens target.
3. The lens orientation control method according to claim 1, characterized in that, The step of reading the lens offset parameters corresponding to the real-time motion direction includes: Based on the real-time motion direction, the initial offset direction and offset magnitude of the lens are found in the preset lens offset parameter table; The lens offset direction is calculated based on the initial offset direction and the preset lens offset compensation algorithm, and the offset amplitude is dynamically adjusted based on the velocity vector of the real-time motion direction to obtain the adjusted lens offset amplitude.
4. The lens orientation control method according to claim 3, characterized in that, The step of calculating the target lens coordinates corresponding to the lens based on the lens offset direction and the lens offset magnitude, and driving the lens to move from the current coordinates to the target lens coordinates, includes: Obtain the current position coordinates of the target lens, and calculate the target lens coordinates based on the lens offset parameters and a preset lens offset model; A smooth interpolation algorithm is used to generate a transition path from the current position coordinates to the target lens coordinates, so as to drive the lens to move from the current coordinates to the target lens coordinates along the transition path, wherein the transition path is a circular path or other path around the lens target.
5. The lens orientation control method according to claim 4, characterized in that, The method of driving the lens to move from the current coordinates to the target lens coordinates also includes: The lens offset amplitude is nonlinearly mapped to the real-time movement speed of the lens target to obtain the corresponding dynamic damping coefficient. The lens orientation of the lens is smoothed based on the dynamic damping coefficient, wherein the filtering adopts a speed-adaptive fourth-order Bezier curve interpolation.
6. The lens orientation control method according to claim 3, characterized in that, The continuous monitoring of the movement direction changes of the lens target, updating the lens offset parameters based on the real-time movement direction of the lens target exceeding a preset change angle threshold, and driving the lens to move to the corresponding updated target lens coordinates based on the updated lens offset parameters, until the lens target exits the climbing state, includes: The movement direction of the lens target is monitored in real time, and the angle between the current movement direction of the lens target and the movement direction at the previous monitoring moment is obtained. If the angle exceeds the preset change angle threshold, the real-time movement direction of the lens target is reacquired, and the lens offset parameter corresponding to the updated real-time movement direction is found in the lens offset parameter table. The current target lens coordinates are calculated based on the updated lens offset parameters, and the lens is driven to move to the coordinate point corresponding to the current target lens coordinates.
7. The lens orientation control method according to any one of claims 1-6, characterized in that, Before the step of determining that the current motion state of the target in the camera is a climbing state, the method further includes: Multi-ray collision detection is performed on the three-dimensional bounding box corresponding to the lens target, wherein the center of gravity of the multi-ray bounding box extends along at least six axes; When the angle between one of the rays originating from the center of gravity of the multi-ray bounding box and the normal of the model configuration of the predefined climbable surface is less than a preset climbing angle threshold, and the length of the ray is less than a preset climbing distance threshold, it is determined that the lens target is currently in a climbing state, and the real-time movement direction of the lens target is monitored accordingly.
8. A lens orientation control device, characterized in that, include: The state determination module is configured to determine the current motion state of the target in the lens as a climbing state and obtain the real-time motion direction of the target in the lens. The parameter reading module is configured to read the lens offset parameters corresponding to the real-time motion direction, wherein the lens offset parameters include the lens offset direction and the lens offset magnitude, and the lens offset direction is inversely related to the real-time motion direction; The lens movement module is configured to calculate the target lens coordinates corresponding to the lens based on the lens offset direction and the lens offset magnitude, and drive the lens to move from the current coordinates to the target lens coordinates; The displacement update module is configured to continuously monitor the movement direction changes of the lens target, update the lens offset parameters based on the real-time movement direction of the lens target exceeding a preset change angle threshold, and drive the lens to move to the corresponding updated target lens coordinates based on the updated lens offset parameters until the lens target exits the climbing state.
9. A lens orientation control device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 7.
10. A non-volatile readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 7, which, when invoked by a computer, executes the steps included in the corresponding method.
Citation Information
Patent Citations
Method and device for processing climbing operation in VR scene
CN106582012A
Method and device for controlling virtual lens in game
CN109718548A
Role climbing method and device, computer equipment and readable storage medium
CN111714891A
Climbing and jumping method and device, computer equipment and computer readable storage medium
CN111729311A
Systems and Methods for Procedurally Animating a Virtual Camera Associated with Player-Controlled Avatars in Video Games
US20220143502A1
Cited By
Lens design method and system for accumulated deviation of interlayer angle
CN122018176A