Control method and device of virtual object, computer device and readable storage medium
Patent Information
- Application Number
- CN202211538853.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-02
- Publication Date
- 2026-08-28
- Estimated Expiration
- 2042-12-02
AI Technical Summary
[0004]有鉴于此,本申请提供了一种虚拟对象的控制方法、装置、计算机设备及可读存储介质,主要目的在于解决目前虚拟对象的运动模型复杂度很高,各种移动状态与流沙场景中的下陷之间的切换以及功能常常会存在冲突,使虚拟对象的控制难度较高,且难以在流沙场景下实现各种其他表现,导致开放世界网络游戏游戏中虚拟对象的技能设计受到局限,无法为玩家带来更新奇的游戏体验的问题
[0070]借由上述技术方案,本申请提供的一种虚拟对象的控制方法、装置、计算机设备及可读存储介质,本申请在虚拟对象进入下陷区域的情况下,控制虚拟对象进入下陷模式,确定虚拟对象的实时状态,根据实时状态,控制虚拟对象在下陷区域展现对应的动画表现,在虚拟对象移动的过程中,按照其在下陷区域中的实际下陷情况进行移动的调整,避免按照常规的地面移动模式控制虚拟对象移动时发生错误或与实际情况不符,保证虚拟对象移动状态切换的正确性,为虚拟对象下陷过程中设计技能的释放提供了可能,使虚拟对象的游戏表现更加真实,赋予游戏角色生命力。
Smart Images

Figure CN117732066B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of game design technology, and in particular to a method, apparatus, computer device, and readable storage medium for controlling virtual objects. Background Technology
[0002] In recent years, game design technology has developed rapidly, and game developers have increasingly higher requirements for games in order to provide a better gaming experience. Many games now place great emphasis on player interaction with the game world's terrain and buildings, incorporating rich and varied landscapes to provide players with different gaming experiences in different environments. Quicksand sinking terrain is a common type of terrain in games. Virtual objects in quicksand sinking terrain will experience states such as slowing down and sinking. Therefore, games need to control virtual objects to simulate their behavior at various stages in quicksand.
[0003] The applicant recognizes that most games currently featuring quicksand-like sinking terrain are single-player games. In single-player games, controlling virtual objects to simulate their behavior in quicksand at various stages only requires focusing on the interaction between the virtual object and the scene, as well as specific functionalities. However, in some open-world multiplayer online synchronous games, the motion models of virtual objects are highly complex. Switching between various movement states and the sinking in quicksand-like terrain often conflicts with each other, making virtual object control more difficult and hindering the achievement of various other behaviors within quicksand-like terrain. Furthermore, if virtual objects possess skills that can influence the generation of quicksand-like sinking terrain, in an open-world multiplayer online synchronous game environment, it is necessary to minimize the amount of synchronized data while ensuring smooth gameplay and complete functionality. These issues limit the design of virtual object skills in open-world online games, preventing the provision of more novel gaming experiences for players. Summary of the Invention
[0004] In view of this, this application provides a method, apparatus, computer device, and readable storage medium for controlling virtual objects. The main purpose is to solve the problem that the motion model of virtual objects is currently very complex, and there are often conflicts between the switching between various movement states and sinking in quicksand scenes, as well as the functions. This makes it difficult to control virtual objects and makes it difficult to achieve various other behaviors in quicksand scenes. As a result, the skill design of virtual objects in open-world online games is limited, and it is impossible to bring players a more novel gaming experience.
[0005] According to a first aspect of this application, a method for controlling a virtual object is provided, the method comprising:
[0006] When a virtual object enters a sunken area, the virtual object is controlled to enter a sunken mode;
[0007] Determine the real-time state of the virtual object, which is determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sunken area.
[0008] Based on the real-time status, the virtual object is controlled to display corresponding animation in the sunken area.
[0009] Optionally, controlling the virtual object to enter a sunken mode when the virtual object enters a sunken area includes:
[0010] The system continuously detects whether the physical volume of the sunken area is triggered, and when the physical volume is detected to be triggered, it determines that the virtual object has entered the sunken area.
[0011] Obtain the speed parameters configured on the physical volume, and control the virtual object to continuously move downward in the sunken area according to the speed parameters;
[0012] Simultaneously, the virtual object is controlled to change from a moving state to a sand sinking state, thus switching the virtual object from moving mode to sinking mode.
[0013] Optionally, controlling the virtual object to continuously move downward in the sunken region according to the speed parameter includes:
[0014] Extract the first-stage sinking speed from the speed parameters, and control the virtual object to move vertically downward in the sinking area at the first-stage sinking speed;
[0015] During the process of controlling the virtual object to move vertically downward at the first stage sinking speed, a capsule body for representing the virtual object is determined, and the distance between the bottom of the capsule body and the upper surface of the physical volume is continuously counted.
[0016] When the distance reaches the distance threshold, the second-stage sinking speed is obtained from the speed parameters. The virtual object is controlled to move vertically downward in the sinking area at the second-stage sinking speed, and the virtual object is controlled to change from the moving state to the quicksand sinking state, so that the virtual object switches from the moving mode to the sinking mode.
[0017] Optionally, determining the real-time state of the virtual object includes:
[0018] Based on the control commands received from the virtual object, calculate the motion parameters of the virtual object and determine the real-time state of the virtual object indicated by the motion parameters; and / or,
[0019] Based on the virtual object, collision detection is performed on the sunken area to obtain the real-time physical collision detection result, and the real-time state of the virtual object indicated by the real-time physical collision detection result is determined.
[0020] The real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following states: standing, moving, sinking in quicksand, jumping, climbing and crossing, and falling from the air.
[0021] Optionally, controlling the virtual object to display corresponding animation in the sunken area based on the real-time state includes:
[0022] A capsule body is determined to represent the virtual object, and capsule body detection and ray detection are performed vertically downward with the capsule body as a reference during the sinking of the virtual object;
[0023] The detection results from the capsule detection and the ray detection are obtained, and the information carried by the detection results is identified as the physical information of the area under the feet of the virtual object.
[0024] Read the ground layer information included in the physical information, and query whether the ground layer information is within the range indicated by the standing conditions;
[0025] If the ground level information is found to be within the range indicated by the standing conditions, it is determined that the physical information indicates that the area under the feet meets the standing conditions. The current forward movement vector of the virtual object is decomposed to obtain the vertical axis component of the forward movement vector in the vertical axis direction, and the movement of the virtual object is controlled according to the vertical axis component.
[0026] If the ground level information is not found to be within the range indicated by the standing conditions, it is determined that the physical information indicates that the area under the feet does not meet the standing conditions. The current sinking speed of the virtual object is collected, the current sinking speed is converted into a current sinking movement vector, a second vector sum of the current sinking movement vector and the forward movement vector is calculated, and the virtual object is controlled to move in the sinking area according to the second vector sum.
[0027] Optionally, the step of decomposing the current forward movement vector of the virtual object to obtain the vertical axis component of the forward movement vector, and controlling the movement of the virtual object according to the vertical axis component, includes:
[0028] Collect the current forward movement vector of the virtual object, and decompose the forward movement vector into multiple sub-vectors according to a preset coordinate system and along the direction indicated by the forward movement vector.
[0029] Extract the vector whose direction is consistent with the vertical axis direction from the plurality of vectors as the vertical axis component, and obtain the component threshold, and compare the vertical axis component with the component threshold;
[0030] If the vertical axis component is less than the component threshold, the current sinking speed of the virtual object in the sinking region is determined, the sinking speed is converted into a sinking movement vector, the sinking movement vector is used to replace the vertical axis component of the forward movement vector in the vertical axis direction in the sinking mode of the virtual object, and the virtual object is controlled to move in the sinking region according to the replaced forward movement vector.
[0031] If the vertical axis component is greater than or equal to the component threshold, the virtual object is controlled to move in the sunken region according to the forward movement vector.
[0032] Optionally, controlling the virtual object to display corresponding animation in the sunken area based on the real-time state includes:
[0033] If a jump command is received based on the virtual object, then the real-time status of the virtual object is queried;
[0034] When the real-time state of the virtual object is the moving state, the jump command is executed;
[0035] When the real-time state of the virtual object is the quicksand sinking state, the physical sinking function of the quicksand sinking state is called based on the virtual object to control the real-time state of the virtual object to change from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode and executes the jump command.
[0036] Optionally, executing the jump instruction includes:
[0037] Obtain the jump ascent velocity associated with the jump command, and convert the jump ascent velocity into a jump movement vector;
[0038] Calculate the first vector sum of the jump movement vector and the forward movement vector, and control the virtual object to move upward in the sunken area according to the first vector sum;
[0039] Simultaneously, the real-time state of the virtual object is changed from the moving state to the falling state, thus switching the virtual object from the moving mode to the falling mode.
[0040] Optionally, controlling the virtual object to display corresponding animation in the sunken area based on the real-time state includes:
[0041] If a climbing command is received while controlling the virtual object to move vertically downward at the first stage sinking speed, then the capsule body of the virtual object is used as a reference to perform capsule body detection horizontally forward;
[0042] When the detection result from the capsule body detection indicates the presence of an obstacle, collision detection is performed on the obstacle using the capsule body as a reference, and the detection result from the collision detection is obtained.
[0043] When the collision detection feedback indicates that the obstacle meets the climbing and crossing conditions, the real-time state of the virtual object is changed from the moving state to the climbing and crossing state, so that the virtual object switches from the moving mode to the climbing and crossing mode, and the virtual object is controlled to climb and cross the obstacle.
[0044] Specifically, when the collision detection feedback indicates that the obstacle does not meet the climbing and crossing conditions, the virtual object is controlled to collide with the obstacle with the current forward movement vector, and the remaining movement vector of the virtual object after the collision is collected. The virtual object is then controlled to slide on the surface of the obstacle according to the remaining movement vector.
[0045] Optionally, the method further includes:
[0046] Determine at least one preset location for creating the sunken area, and create a physical volume as the sunken area at each of the at least one preset location. The physical volume has a triggering function and is used to determine whether a virtual object enters the sunken area and to update the depth parameter of the virtual object sinking in the sunken area; and / or,
[0047] When the virtual object is detected to have left the sunken area based on the physical volume of the sunken area, the physical sinking function of the quicksand sinking state is called in the state machine of the virtual object, and the state of the virtual object's state machine is changed from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode.
[0048] Optionally, the method further includes:
[0049] Receive network synchronization data transmitted from the server, wherein the network synchronization data includes at least one or more of the motion parameters of the virtual object and the real-time status of the virtual object;
[0050] Data synchronization is performed based on the network synchronization data so that the client can display the actions of virtual objects controlled by other users in the sunken area.
[0051] According to a second aspect of this application, a control device for a virtual object is provided, the device comprising:
[0052] The first control module is used to control the virtual object to enter the sinking mode when the virtual object enters the sinking area;
[0053] A determination module is used to determine the real-time state of the virtual object, the real-time state being determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sunken area.
[0054] The second control module is used to control the virtual object to display corresponding animation performance in the sunken area according to the real-time status.
[0055] Optionally, the first control module is configured to continuously detect whether the physical volume of the sunken area is triggered, and when the physical volume is detected to be triggered, determine that the virtual object has entered the sunken area; obtain the speed parameters configured on the physical volume, and control the virtual object to continuously move downward in the sunken area according to the speed parameters; and simultaneously control the virtual object to change from a moving state to a quicksand sinking state, so that the virtual object switches from a moving mode to a sinking mode.
[0056] Optionally, the first control module is configured to extract a first-stage sinking speed from the speed parameters and control the virtual object to move vertically downward in the sinking area at the first-stage sinking speed; while controlling the virtual object to move vertically downward at the first-stage sinking speed, a capsule representing the virtual object is determined, and the distance between the bottom of the capsule and the upper surface of the physical volume is continuously counted; when the counted distance reaches a distance threshold, a second-stage sinking speed is obtained from the speed parameters, the virtual object is controlled to move vertically downward in the sinking area at the second-stage sinking speed, and the virtual object is controlled to change from the moving state to the quicksand sinking state, so that the virtual object switches from the moving mode to the sinking mode.
[0057] Optionally, the determining module is configured to calculate the motion parameters of the virtual object based on the control instructions received by the virtual object, and determine the real-time state of the virtual object indicated by the motion parameters; and / or, perform collision detection on the virtual object towards the sunken area to obtain the real-time physical collision detection result, and determine the real-time state of the virtual object indicated by the real-time physical collision detection result; wherein the real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following states: standing state, moving state, quicksand sinking state, jumping state, climbing and crossing state, and falling from the air state.
[0058] Optionally, the second control module is configured to determine a capsule representing the virtual object, and to perform capsule detection and ray detection vertically downwards with the capsule as a reference during the sinking process of the virtual object; acquire the detection results fed back by the capsule detection and the ray detection, and identify the information carried by the detection results as the physical information of the area under the virtual object's feet; read the ground layer information included in the physical information, and query whether the ground layer information is within the range of the standing condition indication; if the ground layer information is found to be within the range of the standing condition indication, then determine that the physical information indicates that the area under the feet meets the standing condition indication. The system decomposes the current forward movement vector of the virtual object to obtain the vertical axis component of the forward movement vector in the vertical direction, and controls the movement of the virtual object according to the vertical axis component. If the ground level information is found to be outside the range indicated by the standing conditions, it is determined that the physical information indicates that the area under the feet does not meet the standing conditions. The system collects the current sinking speed of the virtual object, converts the current sinking speed into the current sinking movement vector, calculates the second vector sum of the current sinking movement vector and the forward movement vector, and controls the movement of the virtual object in the sinking area according to the second vector sum.
[0059] Optionally, the second control module is configured to acquire the current forward movement vector of the virtual object, decompose the forward movement vector into multiple component vectors according to a preset coordinate system along the direction indicated by the forward movement vector; extract the component vector whose direction is consistent with the vertical axis direction from the multiple component vectors as the vertical axis component, and obtain a component threshold, compare the vertical axis component with the component threshold; if the vertical axis component is less than the component threshold, determine the current sinking speed of the virtual object in the sunken area, convert the sinking speed into a sinking movement vector, replace the vertical axis component of the forward movement vector in the vertical axis direction with the sinking movement vector in the sinking mode of the virtual object, and control the virtual object to move in the sunken area according to the replaced forward movement vector; if the vertical axis component is greater than or equal to the component threshold, control the virtual object to move in the sunken area according to the forward movement vector.
[0060] Optionally, the second control module is configured to: if a jump command is received based on the virtual object, query the real-time state of the virtual object; when the real-time state of the virtual object is the moving state, execute the jump command; when the real-time state of the virtual object is the quicksand sinking state, call the physical sinking function of the quicksand sinking state based on the virtual object, control the real-time state of the virtual object to change from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode and executes the jump command.
[0061] Optionally, the second control module is configured to acquire the jump ascent speed associated with the jump command, convert the jump ascent speed into a jump movement vector; calculate a first vector sum of the jump movement vector and the forward movement vector, and control the virtual object to move upward in the sunken area according to the first vector sum; and simultaneously control the real-time state of the virtual object to change from the movement state to the air-falling state, so that the virtual object switches from the movement mode to the air-falling mode.
[0062] Optionally, the second control module is configured to, if a climbing command is received during the process of controlling the virtual object to move vertically downward at the first-stage sinking speed, perform a horizontal forward capsule detection based on the capsule body of the virtual object; when the detection result of the capsule body detection indicates the presence of an obstacle, perform collision detection on the obstacle based on the capsule body and obtain the detection result of the collision detection; when the detection result of the collision detection indicates that the obstacle meets the climbing and crossing conditions, control the real-time state of the virtual object to change from the moving state to the climbing and crossing state, switch the virtual object from the moving mode to the climbing and crossing mode, and control the virtual object to climb and cross the obstacle; wherein, when the detection result of the collision detection indicates that the obstacle does not meet the climbing and crossing conditions, control the virtual object to collide with the obstacle with the current forward movement vector, collect the remaining movement vector of the virtual object after the collision, and control the virtual object to slide on the surface of the obstacle according to the remaining movement vector.
[0063] Optionally, the device further includes:
[0064] A creation module is used to determine at least one preset location for creating a sunken area, and to create a physical volume as a sunken area at each of the at least one preset location. The physical volume has a triggering function and is used to determine whether a virtual object enters the sunken area and to update the depth parameter of the virtual object sinking in the sunken area; and / or,
[0065] The second control module is further configured to, when the virtual object is detected to have left the sunken area based on the physical volume of the sunken area, call the physical sinking function of the quicksand sinking state in the state machine of the virtual object, control the state in the state machine of the virtual object to change from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode.
[0066] Optionally, the device further includes:
[0067] A synchronization module is used to receive network synchronization data transmitted from the server. The network synchronization data includes at least one or more of the motion parameters of the virtual object and the real-time status of the virtual object. Data synchronization is performed based on the network synchronization data so that the client can display the action of virtual objects controlled by other users in the sunken area.
[0068] According to a third aspect of this application, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method described in any of the first aspects above.
[0069] According to a fourth aspect of this application, a readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first aspects above.
[0070] By employing the above technical solutions, this application provides a method, apparatus, computer device, and readable storage medium for controlling virtual objects. When a virtual object enters a sunken area, this application controls the virtual object to enter a sunken mode, determines the real-time state of the virtual object, and controls the virtual object to display corresponding animation within the sunken area based on the real-time state. During the movement of the virtual object, adjustments are made according to its actual sinking condition within the sunken area, avoiding errors or discrepancies with reality when controlling the virtual object's movement using conventional ground movement modes. This ensures the correctness of the virtual object's movement state switching, provides the possibility for releasing skills during the virtual object's sinking process, makes the game performance of the virtual object more realistic, and gives the game character vitality.
[0071] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description
[0072] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:
[0073] Figure 1 This paper illustrates a flowchart of a virtual object control method provided in an embodiment of this application.
[0074] Figure 2A This paper illustrates a flowchart of another virtual object control method provided in an embodiment of this application.
[0075] Figure 2B This illustration shows a vector decomposition diagram provided in an embodiment of this application;
[0076] Figure 2C This paper illustrates a flowchart of a virtual object control method provided in an embodiment of this application.
[0077] Figure 3 This illustration shows a schematic diagram of the structure of a virtual object control device provided in an embodiment of this application;
[0078] Figure 4 A schematic diagram of the device structure of a computer device provided in an embodiment of this application is shown. Detailed Implementation
[0079] Exemplary embodiments of the present application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this application will be thorough and complete, and will fully convey the scope of the present application to those skilled in the art.
[0080] This application provides a method for controlling virtual objects, such as... Figure 1 As shown, the method includes:
[0081] 101. When a virtual object enters a sunken area, control the virtual object to enter sunken mode.
[0082] Game world maps often contain diverse terrains, providing players with different gameplay experiences in various environments. Quicksand sinking terrain is a common type of terrain in games. Characters in quicksand sinking terrain will experience states such as slowing down and sinking, thus requiring simulation of the character's behavior at different stages in quicksand. Similar to quicksand formations or gameplay, there are other terrains, such as swamps, which also cause players to slow down and sink upon entering, serving a similar function but with different presentation and corresponding gameplay. The applicant recognizes that most games currently featuring quicksand sinking terrain are single-player games. These games do not need to consider network synchronization and only need to focus on the interaction between characters and the environment, as well as specific functionalities, including actions and trigger mechanisms. However, currently, there are few multiplayer online games that implement open-world quicksand sinking terrain, lacking support for multiplayer online environments. Furthermore, due to the high complexity of movement modes in open-world games, switching between various movement modes and functionalities often conflict, significantly increasing the development difficulty.
[0083] Therefore, this application proposes a method for controlling virtual objects. The method creates a sinking area (i.e., quicksand, swamp, or other terrain areas) as a physical volume. When a virtual object enters the sinking area, it is controlled to enter a sinking mode. The real-time state of the virtual object is determined, and based on this state, the virtual object is controlled to display corresponding animation within the sinking area. The real-time state is determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sinking area. This avoids errors or discrepancies with reality when controlling the virtual object's movement using conventional ground movement modes, ensuring the correctness of the virtual object's movement state switching. It also provides the possibility of releasing skills during the virtual object's sinking process, making the game performance of the virtual object more realistic and giving the game character a sense of life.
[0084] This application's embodiments can be applied to single-player games, online games, or virtual worlds, or virtual worlds with network synchronization, developed based on game engines. Specifically, the game engine can be UE4 (Unreal Engine 4), UE5 (Unreal Engine 5), Unity, or other game engines; this application does not impose specific limitations on this. Virtual objects can include buildings, plants, trees, rocks, etc., and can also include NPCs (non-player characters), vehicles, items, or virtual characters, vehicles, items controlled by the client player or other players. Responding to a virtual object's sinking skill release command indicates that the virtual object needs to sink; therefore, a sinking area needs to be generated in the virtual scene, and subsequently, the sinking animation of the virtual object will be displayed within this sinking area. To promptly detect virtual objects entering a sunken area in the game, this embodiment creates a physical volume for the sunken area. This physical volume, in the game development engine, can be a Volume (physical volume) with trigger functionality to adjust the behavior of a specified area in the level. In practice, the physical volume can cause damage to players or other objects within it; it can also serve as a collision volume to prevent specific objects from entering or leaving the volume; it can perform specific operations and settings when an object enters the volume; or it can change the way lighting and visibility are calculated in the level. This embodiment uses this physical volume as a trigger for entering or leaving the sunken area to determine whether a virtual object has entered or left the sunken area. In practical applications, this physical volume can be denoted as DriftSandVolume in the game development engine. Thus, when the physical volume of the sunken area is detected to be triggered by a virtual object, it is determined that the virtual object has entered the sunken area.
[0085] To ensure smooth transitions between other states and the sinking state, this embodiment modifies the state machine of the virtual object to control its entry into sinking mode and its sinking within the sinking area. The sinking mode is a movement mode defined by the developers in the game engine, specifically the Move_Custom_Sub_DriftSandFalling mode. This mode marks the movement of the virtual object into quicksand sinking and synchronizes the movement using this marker. In this custom movement mode, there is a maximum speed limit in the horizontal direction, while the vertical direction uses different sinking speeds based on depth and the virtual object's state. When the player releases a jump or climb command, the virtual object's speed is calculated based on the associated value of the command. Collision detection is then performed during the virtual object's movement, and the movement state is switched based on the detection results and the current state.
[0086] 102. Determine the real-time status of the virtual object.
[0087] The real-time state is determined based on at least one or both of the control instructions for the virtual object and the real-time physical collision detection results between the virtual object and the sunken area. The real-time state indicates the current state of the virtual object. Subsequently, based on the real-time state, the virtual object can be controlled to perform animation to realistically simulate the sunken state of the virtual object.
[0088] 103. Based on the real-time status, control the virtual object to display the corresponding animation in the sunken area.
[0089] Once the real-time state is determined, the virtual object can be controlled to display corresponding animations in the sunken area. In the game, this can be used to show whether the virtual object is in the sunken area, whether it slows down, whether it is in a sunken state, etc.
[0090] The method provided in this application embodiment controls the virtual object to enter a sinking mode when the virtual object enters a sinking area. It determines the real-time state of the virtual object and, based on this state, controls the virtual object to display corresponding animation within the sinking area. During the virtual object's movement, the movement is adjusted according to its actual sinking condition within the sinking area. This avoids errors or discrepancies with reality when controlling the virtual object's movement using conventional ground movement modes, ensuring the correctness of the virtual object's movement state switching. It also provides the possibility of releasing skills during the virtual object's sinking process, making the virtual object's game performance more realistic and giving the game character a sense of life.
[0091] Furthermore, as a refinement and extension of the specific implementation methods of the above embodiments, in order to fully illustrate the specific implementation process of this embodiment, this application provides another method for controlling virtual objects, such as... Figure 2A As shown, the method includes:
[0092] 201. When a virtual object enters a sunken area, control the virtual object to enter sunken mode.
[0093] To promptly detect virtual objects entering sunken areas in the game, this embodiment creates a physical volume for the sunken area. This physical volume has a triggering function and is used to determine whether a virtual object has entered the sunken area and update the depth parameters of the virtual object's submersion within the sunken area. In the game development engine, this physical volume can be a Volume, which has a triggering function to adjust the behavior of a specified area in the level. In practice, the physical volume can cause damage to players or other objects within it; it can also serve as a collision volume to prevent specific objects from entering or leaving the volume; it can perform specific operations and settings when an object enters the volume; or it can change the way lighting and visibility are calculated in the level. This embodiment uses this physical volume as a trigger for entering and leaving the sunken area to determine whether a virtual object has entered or left the sunken area. In practical applications, this physical volume can be denoted as DriftSandVolume in the game development engine. Thus, when the physical volume of the sunken area is detected to be triggered by a virtual object, it is determined that the virtual object has entered the sunken area.
[0094] To ensure smooth transitions between other states and the sinking state, this embodiment modifies the state machine of the virtual object to control its entry into sinking mode and its sinking within the sinking area. The sinking mode is a movement mode defined by the developers in the game engine, specifically the Move_Custom_Sub_DriftSandFalling mode. This mode marks the movement of the virtual object into quicksand sinking and synchronizes the movement using this marker. In this custom movement mode, there is a maximum speed limit in the horizontal direction, while the vertical direction uses different sinking speeds based on depth and the virtual object's state. When the player releases a jump or climb command, the virtual object's speed is calculated based on the associated value of the command. Collision detection is then performed during the virtual object's movement, and the movement state is switched based on the detection results and the current state.
[0095] It should be noted that, to make the virtual object's actions during the sinking process more realistic, this embodiment also adds a corresponding quicksand state machine to the game scene's animation blueprint. Specifically, at least one sinking area is defined in the game scene's animation blueprint, and a sinking area state machine is added to each of these areas. Thus, when controlling the virtual object to sink within a sinking area, the virtual object's actions are controlled according to the vector changes during the sinking process, following the instructions of the sinking area state machine. The sinking area state machine can pre-add states of entering quicksand and sinking into quicksand, including standing, walking, and sinking states. By using the virtual object's speed and state as parameters, combined with corresponding motion fusion and montage, the virtual object's character actions in the quicksand can be reflected, such as slowing down while walking, sinking into quicksand, and dying from sinking into quicksand.
[0096] 202. Determine the real-time status of the virtual object.
[0097] The real-time state is determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sunken area. Specifically, when determining the real-time state of the virtual object, the motion parameters of the virtual object can be calculated based on the control commands received by the virtual object, and the real-time state of the virtual object indicated by the motion parameters can be determined. Alternatively, collision detection can be performed on the virtual object against the sunken area to obtain real-time physical collision detection results, and the real-time state of the virtual object indicated by the real-time physical collision detection results can be determined. Specifically, the real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following states: standing, moving, sinking in quicksand, jumping, climbing / crossing, and falling from the air. The process of determining the real-time state is described below:
[0098] Whether a virtual object enters a sinking mode is determined by the area beneath its feet. If the area supports standing, the virtual object can remain in movement mode; otherwise, it needs to enter sinking mode. Therefore, the game engine defines a capsule to represent the virtual object. During the sinking process, it performs capsule-based and ray-based detection vertically downwards, acquiring the detection results. The information carried by these results is used as the physical information of the virtual object's foot area. This physical information is then used to determine if the ground beneath the virtual object supports standing. When determining if the area supports standing, the game engine reads the ground layer information included in the physical information. If the ground layer information falls within the standing condition indication range, the area meets the standing condition. For example, assuming a ground layer between 1 and 12 supports standing, if the physical information includes a ground layer of 3, the area supports standing, thus meeting the standing condition. Conversely, if the physical information includes a ground layer of 13, the area does not support standing, thus failing to meet the standing condition.
[0099] If the physical information indicates that the area under the feet meets the standing conditions, the game engine will decompose the current forward movement vector of the virtual object to obtain the vertical axis component of the forward movement vector. Based on the value of the vertical axis component, it determines how to control the virtual object's descent. Specifically, during the decomposition of the forward movement vector, the game engine collects the current forward movement vector of the virtual object, decomposes it into multiple component vectors according to a preset coordinate system along the direction indicated by the forward movement vector, and extracts the component vector whose direction is consistent with the vertical axis direction as the vertical axis component. The vertical axis component is also known as the Z-axis component; for details, please refer to [link to relevant documentation]. Figure 2B The forward movement vector is decomposed into Z-axis and X-axis components along the direction indicated by the forward movement vector, and the Z-axis components are used in subsequent evaluation processes.
[0100] After determining the vertical axis component, the game engine obtains a component threshold and compares the vertical axis component with the threshold, which can be 0. If the vertical axis component is less than the threshold, it indicates that the virtual object is moving downwards along the direction of the forward movement vector. In this case, the sinking speed of the virtual object in the sunken area needs to be considered in the downward movement process. Therefore, the game engine determines the current sinking speed of the virtual object in the sunken area and converts it into a sinking movement vector, so that the sinking speed is considered in the form of a vector in the downward movement process of the virtual object. Specifically, in the sinking mode of the virtual object, the game engine replaces the vertical axis component of the forward movement vector in the vertical axis direction with the sinking movement vector, and controls the virtual object to move in the sunken area according to the replaced forward movement vector. That is, the sinking speed of the virtual object in the sunken area is converted into a movement amount and overwrites the Z component of the previously calculated forward movement vector. This avoids the error caused by using the ground walking movement mode when the virtual object moves up and down the slope in the physical volume of the sunken area.
[0101] If the vertical axis component is greater than or equal to the component threshold, it means that the virtual object still has an upward trend and its movement needs to be controlled according to the forward movement vector. For the time being, there is no need to take into account the sinking speed of the virtual object in the sunken area. Therefore, the game development engine controls the movement of the virtual object in the sunken area according to the forward movement vector.
[0102] Accordingly, if the physical information indicates that the area under the virtual object's feet does not meet the standing conditions, the game engine can directly control the virtual object's movement by referring to its current sinking speed. Therefore, the game engine will collect the virtual object's current sinking speed, convert it into a current sinking movement vector, calculate the second vector sum of the current sinking movement vector and the forward movement vector, and control the virtual object's movement within the sinking area according to the second vector sum. Specifically, when determining whether the area under the virtual object's feet supports standing, the game engine will read the ground layer information included in the physical information. If the ground layer information is not within the range indicated by the standing conditions, the game engine determines that the area under the virtual object does not meet the standing conditions. The specific process of determining whether the area under the virtual object meets the standing conditions can be found in the description above and will not be repeated here.
[0103] In the game, virtual objects enter the sinking area from the air or the ground. Therefore, the game engine continuously monitors whether the physical volume of the sinking area is triggered, and when a physical volume is triggered, it determines that the virtual object is currently located within the sinking area. Specifically, since the physical volume can be labeled as a DriftSandVolume, in practical applications, the game engine can use triggers to determine whether a character has entered a DriftSandVolume. It should be noted that using this DriftSandVolume trigger, the game engine can also monitor the departure, death, or respawn of virtual objects. In actual game design, developers may want virtual objects to sink quickly in swamps or slowly in quicksand to ensure consistency with environmental realities. Therefore, in this embodiment, the speed parameter of the virtual object sinking in the sinking area can be pre-configured on the physical volume. This speed parameter indicates how fast the virtual object sinks in the sinking area, satisfying the different needs of developers when designing different sinking areas.
[0104] Thus, upon detecting that a virtual object has entered a sinking area, the game development engine retrieves the speed parameters configured in its physical volume and controls the virtual object to continuously move downwards within the sinking area according to these parameters. Simultaneously, the virtual object's state machine changes from a moving state to a quicksand sinking state, switching the virtual object from moving mode to sinking mode. The sinking mode is a movement mode defined by the developers in the game development engine, specifically the Move_Custom_Sub_DriftSandFalling mode. This sinking mode is used to mark the movement method of the virtual object entering the quicksand sinking area, and synchronization is achieved through this marker. Furthermore, the basic sinking process in this embodiment is actually divided into two stages. In the first stage, the virtual object sinks at a relatively high speed, and after reaching a certain depth, due to resistance, it transitions to a slower sinking in the second stage. The following describes how the two stages are connected:
[0105] First, the game engine extracts the initial sinking speed from the speed parameters and controls the virtual object to move vertically downwards within the sinking area at the initial sinking speed. While controlling the virtual object to move vertically downwards at the initial sinking speed, the game engine determines the capsule representing the virtual object and continuously calculates the distance between the bottom of the capsule and the top surface of the physical volume.
[0106] When the distance reaches the threshold, it indicates that the second stage of sinking needs to be entered. Therefore, the game development engine will obtain the second stage sinking speed from the speed parameter, control the virtual object to move vertically downward in the sinking area at the second stage sinking speed, and change the state of the virtual object's state machine from the moving state to the quicksand sinking state, so that the virtual object switches from the moving mode to the sinking mode. The sinking mode limits the maximum speed of the virtual object in the horizontal direction, and limits the speed in the vertical direction according to the depth and the state of the virtual object.
[0107] It's important to note that in practical applications, virtual objects may die or successfully escape the sinking area during the process. In such cases, it's necessary to modify the virtual object's movement mode to exit the custom sinking mode. Therefore, when the game engine detects that a virtual object has left the sinking area based on its physical volume, the engine calls the physical sinking function for the quicksand sinking state in the virtual object's state machine. This changes the virtual object's state from the quicksand sinking state to the movement state, causing the virtual object to exit the sinking mode.
[0108] 203. Based on the sinking calculation results, display the sinking animation of virtual objects within the sinking area.
[0109] After completing the above process to configure the game scene and determine the real-time state of the virtual objects, you can start to display the sinking animation of the virtual objects in the sinking area based on the sinking calculation results.
[0110] In practical applications, when a virtual object enters the first stage of its sinking process, it is allowed to jump. This allows players to jump upwards within the sinking area to refresh the depth of the virtual object's immersion. In the game, a normal jump requires the virtual object to be on the ground. However, the marked `DriftSandVolume` is merely a physical volume inherited from `Volume`, not the actual ground. Therefore, jumping within the sinking area requires special handling; the `DriftSandVolume` is treated as the ground for the virtual object to complete the jump. As described above, when a virtual object enters a `DriftSandVolume`, its movement mode changes to the custom sinking mode `Move_Custom_Sub_DriftSandFalling`. The virtual object's speed along the vertical axis is determined by the speed parameters configured in the `DriftSandVolume`. However, when the virtual object jumps, it is given an upward velocity, and its movement mode is changed. Therefore, in this embodiment, if a jump command is received based on a virtual object, the game development engine will first read the state set in the virtual object's state machine and determine whether the virtual object's movement mode needs to be changed based on the state. When the state set in the state machine is the movement state, it means that the current virtual object is in movement mode, and the area under the virtual object's feet can be considered the ground, meaning that a jump can be performed directly based on the movement mode. Therefore, the game development engine executes the jump command. However, when the state set in the state machine is the quicksand sinking state, it means that the current virtual object is in a custom sinking mode, and the jump command cannot be executed directly. The game development engine will call the physical sinking function of the quicksand sinking state in the virtual object's state machine, control the state in the virtual object's state machine to change from the quicksand sinking state to the movement state, causing the virtual object to exit the sinking mode, that is, exit Move_Custom_Sub_DriftSandFalling, and then execute the jump command. It should be noted that if the upward speed during a jump is insufficient, the game engine cannot exit the custom trap mode by controlling the virtual object to leave the DriftSandVolume. Therefore, the game engine needs to actively exit the trap mode within the physical trap function, which can specifically be the PhysCustomDriftSandFalling function. Furthermore, executing a jump command not only requires exiting the Move_Custom_Sub_DriftSandFalling mode but also requires controlling the virtual object's movement according to the jump ascent speed associated with the jump command. Therefore, the process of executing a jump command is described below:
[0111] First, the game engine obtains the jump ascent velocity associated with the jump command and converts it into a jump movement vector. Then, the game engine calculates the first vector sum of the jump movement vector and the forward movement vector, and controls the virtual object to move upwards within the sunken area according to this first vector sum. Simultaneously, the state in the virtual object's state machine is changed from a moving state to a falling state, thus switching the virtual object from moving mode to falling mode. The falling mode can be the Move_Falling mode.
[0112] Furthermore, upon entering the first stage, the virtual object is allowed to perform climbing and traversing actions. The following describes the process of the virtual object entering the climbing and traversing phase in the sunken area:
[0113] If a climb command is received while the virtual object is moving vertically downwards at the first-stage sinking speed, the game engine will use the capsule as a reference point and perform a capsule-like detection horizontally forward. The result of this detection will determine if the virtual object's movement path is obstructed by other objects. When the capsule detection indicates the presence of an obstacle, it's necessary to check whether climbing across that obstacle is permitted. This involves performing collision detection on the obstacle using the capsule as a reference point and obtaining the collision detection results. In practical applications, the game engine can execute the UE4 function `HandleImpact`, which handles collision logic during movement and checks whether the obstacle meets the conditions for climbing across. Accordingly, when the collision detection feedback indicates that the obstacle meets the climbing and crossing conditions, the virtual object needs to be controlled to enter the climbing and crossing movement mode. The state in the virtual object's state machine is changed from the movement state to the climbing and crossing state, so that the virtual object switches from the movement mode to the climbing and crossing mode and controls the virtual object to climb and cross the obstacle. When the collision detection feedback indicates that the obstacle does not meet the climbing and crossing conditions, the game development engine will control the virtual object to collide with the obstacle with the current forward movement vector, and collect the remaining movement vector of the virtual object after the collision. The virtual object is then controlled to slide on the obstacle surface according to the remaining movement vector. That is, the virtual object slides on the obstacle surface with the remaining movement amount after colliding with the obstacle.
[0114] Since this embodiment addresses a multiplayer online game environment, it's necessary to minimize the amount of synchronized data while ensuring smooth gameplay and full functionality. Therefore, when the game engine controls the virtual object to display corresponding animations in the sunken area based on real-time status, it receives network synchronization data transmitted from the server. This network synchronization data includes at least one or more of the virtual object's motion parameters and real-time status. Data synchronization is then performed based on this network synchronization data to allow clients to see the actions of virtual objects controlled by other users in the sunken area. The process of synchronizing the virtual object's character model data to other clients consists of two parts: first, synchronizing the virtual object's displacement to at least one client. This involves synchronizing the player's virtual object's movement mode, speed, acceleration, position information, and orientation information. During synchronization, the player's current control terminal and the server providing the game services simultaneously perform frame-by-frame calculations and synchronization. The server performs verification and correction before distributing the various data to each client. This allows other players to see the specific displacement, orientation, and other details of the player's virtual object in the sunken area. Another part is to synchronize the behavior of virtual objects to other clients. Whether a virtual object is in a sunken area, whether it is decelerating, whether it is in a sunken state, etc., will be synchronized to at least one client. This synchronization process can actually be achieved through attribute synchronization and state machine manager state synchronization, so as to ensure that the state of the virtual object in the sunken area is consistent on the master control end, the server and at least one client.
[0115] In summary, the logical process and mode switching of the virtual object control method proposed in this application are summarized as follows:
[0116] like Figure 2CAs shown, after the game starts, the game engine continuously checks whether virtual objects have entered the physical volume of the sinking area, `DriftSandVolume`. If no virtual object is detected, the current detection state is maintained; however, if a virtual object is detected, it is controlled to enter the sinking mode `Move_Custom_Sub_DriftSandFalling`. In actual application, after entering the sinking mode `Move_Custom_Sub_DriftSandFalling`, if no other skill commands are received, the game engine will identify whether the area under the virtual object's feet meets the standing conditions. When it is determined that the standing conditions are met, the forward movement vector of the virtual object is decomposed to determine the Z-axis component. When the Z-axis component is less than 0, the sinking velocity of the virtual object is converted into a sinking movement vector, and the Z-axis component of the sinking movement vector is used to replace the Z-axis component of the forward movement vector of the virtual object. The virtual object is then controlled to move according to the first few movement vectors after the replacement. When the Z-axis component is greater than or equal to 0, the forward movement vector is still used to control the movement of the virtual object. Additionally, when it's determined that the area beneath the virtual object's feet does not meet the standing conditions, the game engine collects the virtual object's current sinking speed, converts it into a current sinking movement vector, calculates the second vector sum of the current sinking movement vector and the forward movement vector, and controls the virtual object's movement within the sinking area according to this second vector sum. It should be noted that during the movement of the virtual object, it may receive climbing or traversing commands. In this case, it needs to detect whether there are obstacles blocking the virtual object's path. If so, it checks whether the obstacle can be climbed or traversed. If the obstacle can be climbed or traversed, the virtual object is controlled to climb or traverse it; otherwise, the virtual object is controlled to slide on the obstacle's surface. Furthermore, in practical applications, after detecting that a virtual object has entered the sinking area and controlling the virtual object to enter the sinking mode Move_Custom_Sub_DriftSandFalling, a jump command for the virtual object may be received. Since the virtual object has already entered the sinking mode Move_Custom_Sub_DriftSandFalling, and the jump logic needs to be performed in the movement mode, it is necessary to control the virtual object to exit the sinking mode Move_Custom_Sub_DriftSandFalling, so that the virtual object is in the movement mode, and then execute the jump logic.
[0117] The method provided in this application adjusts the movement of virtual objects according to their actual sinking status in the sunken area during the movement process. This avoids errors or discrepancies with the actual situation when controlling the movement of virtual objects according to the conventional ground movement mode, ensuring the correctness of the switching of the virtual object's movement state. At the same time, the design of the sinking function can also be associated with or applied to the skill system, enabling the design of skill gameplay that can transform the scene terrain into sinking terrain in the game. This expands the possibilities of skill design and can also provide different gameplay experiences corresponding to different terrains in open-world games or the many rich terrains that exist in the virtual world itself, bringing more openness, exploration, and playability to the open world.
[0118] Furthermore, as Figure 1 To specifically implement the method, this application provides a control device for a virtual object, such as... Figure 3 As shown, the device includes: a first control module 301, a determination module 302, and a second control module 303.
[0119] The first control module is used to control the virtual object to enter a sunken mode when the virtual object enters the sunken area;
[0120] The determining module is used to determine the real-time state of the virtual object, which is determined based on at least one or both of the control instructions for the virtual object and the real-time physical collision detection results between the virtual object and the sunken area.
[0121] The second control module is used to control the virtual object to display corresponding animation in the sunken area according to the real-time status.
[0122] In a specific application scenario, the first control module 301 is used to continuously detect whether the physical volume of the sunken area is triggered, and when the physical volume is detected to be triggered, to determine that the virtual object has entered the sunken area; to obtain the speed parameters configured on the physical volume, and to control the virtual object to continuously move downward in the sunken area according to the speed parameters; and to control the virtual object to change from a moving state to a quicksand sinking state, so that the virtual object switches from a moving mode to a sinking mode.
[0123] In a specific application scenario, the first control module 301 is used to extract the first-stage sinking speed from the speed parameters and control the virtual object to move vertically downward in the sinking area at the first-stage sinking speed; during the process of controlling the virtual object to move vertically downward at the first-stage sinking speed, a capsule body representing the virtual object is determined, and the distance between the bottom of the capsule body and the upper surface of the physical volume is continuously counted; when the counted distance reaches a distance threshold, a second-stage sinking speed is obtained from the speed parameters, the virtual object is controlled to move vertically downward in the sinking area at the second-stage sinking speed, and the virtual object is controlled to change from the moving state to the quicksand sinking state, so that the virtual object switches from the moving mode to the sinking mode.
[0124] In a specific application scenario, the determining module 302 is used to calculate the motion parameters of the virtual object based on the control instructions received by the virtual object, and determine the real-time state of the virtual object indicated by the motion parameters; and / or, perform collision detection on the virtual object towards the sunken area to obtain the real-time physical collision detection result, and determine the real-time state of the virtual object indicated by the real-time physical collision detection result; wherein the real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following: standing state, moving state, quicksand sinking state, jumping state, climbing and crossing state, and falling from the air state.
[0125] In a specific application scenario, the second control module 303 is used to determine the capsule representing the virtual object, and to perform capsule detection and ray detection vertically downwards with the capsule as a reference during the sinking process of the virtual object; to acquire the detection results fed back by the capsule detection and the ray detection, and to identify the information carried by the detection results as the physical information of the area under the virtual object's feet; to read the ground layer information included in the physical information, and to query whether the ground layer information is within the range indicated by the standing conditions; if the ground layer information is found to be within the range indicated by the standing conditions, then the physical information is determined to indicate the area under the feet. If the standing conditions are met, the current forward movement vector of the virtual object is decomposed to obtain the vertical axis component of the forward movement vector in the vertical direction, and the movement of the virtual object is controlled according to the vertical axis component. If the ground layer information is found to be outside the range indicated by the standing conditions, it is determined that the physical information indicates that the area under the feet does not meet the standing conditions. The current sinking speed of the virtual object is collected, the current sinking speed is converted into the current sinking movement vector, the second vector sum of the current sinking movement vector and the forward movement vector is calculated, and the virtual object is controlled to move in the sinking area according to the second vector sum.
[0126] In a specific application scenario, the second control module 303 is used to acquire the current forward movement vector of the virtual object, decompose the forward movement vector into multiple component vectors according to a preset coordinate system along the direction indicated by the forward movement vector; extract the component vector whose direction is consistent with the vertical axis direction from the multiple component vectors as the vertical axis component, and obtain a component threshold, compare the vertical axis component with the component threshold; if the vertical axis component is less than the component threshold, determine the current sinking speed of the virtual object in the sunken area, convert the sinking speed into a sinking movement vector, replace the vertical axis component of the forward movement vector in the vertical axis direction with the sinking movement vector in the sinking mode of the virtual object, and control the virtual object to move in the sunken area according to the replaced forward movement vector; if the vertical axis component is greater than or equal to the component threshold, control the virtual object to move in the sunken area according to the forward movement vector.
[0127] In a specific application scenario, the second control module 303 is used to query the real-time state of the virtual object if a jump command is received based on the virtual object; when the real-time state of the virtual object is the moving state, execute the jump command; when the real-time state of the virtual object is the quicksand sinking state, call the physical sinking function of the quicksand sinking state based on the virtual object, control the real-time state of the virtual object to change from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode and executes the jump command.
[0128] In a specific application scenario, the second control module 303 is used to obtain the jump ascent speed associated with the jump command, convert the jump ascent speed into a jump movement vector; calculate the first vector sum of the jump movement vector and the forward movement vector, and control the virtual object to move upward in the sunken area according to the first vector sum; at the same time, control the real-time state of the virtual object to change from the movement state to the air falling state, so that the virtual object switches from the movement mode to the air falling mode.
[0129] In a specific application scenario, the second control module 303 is used to, if a climbing command is received during the process of controlling the virtual object to move vertically downward at the first-stage sinking speed, perform a horizontal forward capsule detection based on the capsule body of the virtual object; when the detection result of the capsule body detection indicates the presence of an obstacle, perform collision detection on the obstacle based on the capsule body and obtain the detection result of the collision detection; when the detection result of the collision detection indicates that the obstacle meets the climbing and crossing conditions, control the real-time state of the virtual object to change from the moving state to the climbing and crossing state, so that the virtual object switches from the moving mode to the climbing and crossing mode, and controls the virtual object to climb and cross the obstacle; wherein, when the detection result of the collision detection indicates that the obstacle does not meet the climbing and crossing conditions, control the virtual object to collide with the obstacle with the current forward movement vector, collect the remaining movement vector of the virtual object after the collision, and control the virtual object to slide on the surface of the obstacle according to the remaining movement vector.
[0130] In specific application scenarios, the device also includes:
[0131] A creation module is used to determine at least one preset location for creating a sunken area, and to create a physical volume as a sunken area at each of the at least one preset location. The physical volume has a triggering function and is used to determine whether a virtual object enters the sunken area and to update the depth parameter of the virtual object sinking in the sunken area; and / or,
[0132] The second control module 303 is further configured to, when the virtual object is detected to have left the sunken area based on the physical volume of the sunken area, call the physical sinking function of the quicksand sinking state in the state machine of the virtual object, control the state in the state machine of the virtual object to change from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode.
[0133] In specific application scenarios, the device also includes:
[0134] A synchronization module is used to receive network synchronization data transmitted from the server. The network synchronization data includes at least one or more of the motion parameters of the virtual object and the real-time status of the virtual object. Data synchronization is performed based on the network synchronization data so that the client can display the action of virtual objects controlled by other users in the sunken area.
[0135] The device provided in this application embodiment controls the virtual object to enter a sinking mode when the virtual object enters a sinking area. It determines the real-time state of the virtual object and controls the virtual object to display corresponding animation performance in the sinking area based on the real-time state. During the movement of the virtual object, the movement is adjusted according to its actual sinking situation in the sinking area. This avoids errors or discrepancies with the actual situation when controlling the movement of the virtual object according to the conventional ground movement mode, ensuring the correctness of the virtual object's movement state switching. It provides the possibility for the release of design skills during the virtual object's sinking process, making the game performance of the virtual object more realistic and giving the game character vitality.
[0136] It should be noted that other corresponding descriptions of the functional units involved in the virtual object control device provided in this application embodiment can be found by referring to... Figure 1 and Figures 2A to 2C The corresponding description in [the document] will not be repeated here.
[0137] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0138] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
[0140] In an exemplary embodiment, see Figure 4 The invention also provides a computer device including a bus, a processor, a memory, and a communication interface. It may also include an input / output interface and a display device, wherein the various functional units can communicate with each other via the bus. The memory stores a computer program, and the processor executes the program stored in the memory to perform the control method for the virtual object in the above embodiments.
[0141] A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the control method for the virtual object.
[0142] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented in hardware or by using software plus necessary general-purpose hardware platforms. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) and includes several instructions to cause a computer device (such as a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0143] Those skilled in the art will understand that the accompanying drawings are merely schematic diagrams of a preferred embodiment, and the modules or processes shown in the drawings are not necessarily essential for implementing this application.
[0144] Those skilled in the art will understand that the modules in the apparatus of the implementation scenario can be distributed within the apparatus of the implementation scenario as described, or they can be located in one or more apparatuses different from this implementation scenario, with corresponding changes. The modules of the above-described implementation scenario can be combined into one module, or they can be further divided into multiple sub-modules.
[0145] The serial numbers in this application are for descriptive purposes only and do not represent the merits or demerits of the implementation scenario.
[0146] The above disclosures are only a few specific implementation scenarios of this application. However, this application is not limited to these. Any variations that can be conceived by those skilled in the art should fall within the protection scope of this application.
Claims
1. A method for controlling a virtual object, characterized in that, include: When a virtual object enters a sunken area, the virtual object is controlled to enter a sunken mode; wherein, the sunken area is created as a physical volume, the physical volume has a trigger function and is used to determine whether a virtual object has entered the sunken area and update the depth parameter of the virtual object sinking in the sunken area; The real-time state of the virtual object is determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sunken area. Determining the real-time state of the virtual object includes: performing collision detection on the virtual object towards the sunken area, obtaining the real-time physical collision detection results, and determining the real-time state of the virtual object indicated by the real-time physical collision detection results. The real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following states: standing, moving, sinking in quicksand, jumping, climbing / crossing, and falling from the air. Based on the real-time status, the virtual object is controlled to display corresponding animation in the sunken area.
2. The method according to claim 1, characterized in that, The step of controlling the virtual object to enter a sunken mode when the virtual object enters a sunken area includes: The system continuously detects whether the physical volume of the sunken area is triggered, and when the physical volume is detected to be triggered, it determines that the virtual object has entered the sunken area. Obtain the speed parameters configured on the physical volume, and control the virtual object to continuously move downward in the sunken area according to the speed parameters; Simultaneously, the virtual object is controlled to change from a moving state to a sand sinking state, thus switching the virtual object from moving mode to sinking mode.
3. The method according to claim 2, characterized in that, The step of controlling the virtual object to continuously move downward in the sunken area according to the speed parameter includes: Extract the first-stage sinking speed from the speed parameters, and control the virtual object to move vertically downward in the sinking area at the first-stage sinking speed; During the process of controlling the virtual object to move vertically downward at the first stage sinking speed, a capsule body for representing the virtual object is determined, and the distance between the bottom of the capsule body and the upper surface of the physical volume is continuously counted. When the distance reaches the distance threshold, the second-stage sinking speed is obtained from the speed parameters. The virtual object is controlled to move vertically downward in the sinking area at the second-stage sinking speed, and the virtual object is controlled to change from the moving state to the quicksand sinking state, so that the virtual object switches from the moving mode to the sinking mode.
4. The method according to claim 1, characterized in that, Determining the real-time state of the virtual object further includes: Based on the control instructions received from the virtual object, the motion parameters of the virtual object are calculated, and the real-time state of the virtual object indicated by the motion parameters is determined.
5. The method according to claim 4, characterized in that, The step of controlling the virtual object to display corresponding animation in the sunken area based on the real-time state includes: If a climbing command is received while controlling the virtual object to move vertically downward at the first stage sinking speed, then the capsule body of the virtual object is used as a reference to perform capsule body detection horizontally forward; When the detection result from the capsule body detection indicates the presence of an obstacle, collision detection is performed on the obstacle using the capsule body as a reference, and the detection result from the collision detection is obtained. When the collision detection feedback indicates that the obstacle meets the climbing and crossing conditions, the real-time state of the virtual object is controlled to change from the moving state to the climbing and crossing state, so that the virtual object switches from the moving mode to the climbing and crossing mode, and the virtual object is controlled to climb and cross the obstacle. Specifically, when the collision detection feedback indicates that the obstacle does not meet the climbing and crossing conditions, the virtual object is controlled to collide with the obstacle with the current forward movement vector, and the remaining movement vector of the virtual object after the collision is collected. The virtual object is then controlled to slide on the surface of the obstacle according to the remaining movement vector.
6. The method according to claim 1, characterized in that, The method further includes: Determine at least one preset location where the depression region is to be created, and create a physical volume as the depression region at each of the at least one preset location; and / or, When the virtual object is detected to have left the sunken area based on the physical volume of the sunken area, the physical sinking function of the quicksand sinking state is called in the state machine of the virtual object, and the state of the virtual object's state machine is changed from the quicksand sinking state to the moving state, so that the virtual object exits the sinking mode.
7. The method according to any one of claims 1-6, characterized in that, The method further includes: Receive network synchronization data transmitted from the server, wherein the network synchronization data includes at least one or more of the motion parameters of the virtual object and the real-time status of the virtual object; Data synchronization is performed based on the network synchronization data so that the client can display the actions of virtual objects controlled by other users in the sunken area.
8. A control device for a virtual object, characterized in that, include: The first control module is used to control the virtual object to enter the sinking mode when the virtual object enters the sinking area; wherein, the sinking area is created as a physical volume, the physical volume has a trigger function and is used to determine whether a virtual object has entered the sinking area and update the depth parameter of the virtual object sinking in the sinking area; A determining module is used to determine the real-time state of the virtual object, the real-time state being determined based on at least one or both of the control commands to the virtual object and the real-time physical collision detection results between the virtual object and the sunken area; wherein, the determining module is used to perform collision detection on the virtual object towards the sunken area, obtain the real-time physical collision detection results, and determine the real-time state of the virtual object indicated by the real-time physical collision detection results; wherein, the real-time state is controlled and changed by the real-time state controller of the virtual object, and the real-time state includes at least one or more of the following states: standing state, moving state, quicksand sinking state, jumping state, climbing and crossing state, and falling from the air state; The second control module is used to control the virtual object to display corresponding animation performance in the sunken area according to the real-time status.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Virtual character control method and device in virtual environment, equipment and medium
CN111298440A