Virtual object interaction method and device
By calculating the transition trajectory to control the interaction between the second virtual object and the first virtual object, the problem of unsmooth animation switching and misalignment in virtual object interaction is solved, and the smoothness and authenticity of the interaction are improved.
Patent Information
- Application Number
- CN202211407675.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-10
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2042-11-10
AI Technical Summary
In game scenes, the interaction between virtual objects often affects the user experience due to unsmooth animation switching and misalignment.
By determining the current position and interactive action information of the first virtual object, the transition trajectory of the second virtual object is calculated, so that it interacts with the first virtual object along the transition trajectory when playing the interactive animation data, compensating for position deviation and avoiding dislocation.
It improves the fluency and realism of virtual object interaction and improves the user experience.
Smart Images

Figure CN115888111B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and more particularly to a virtual object interaction method, a virtual object interaction apparatus, a computing device, and a computer-readable storage medium. Background Art
[0002] In gaming scenarios, animation is a key indicator of game quality. The interactions between virtual objects in a game typically involve creating a series of interactive animations, which are played in different interaction scenarios to present the user with the interactive scenes between virtual objects.
[0003] However, since virtual objects themselves have their own animations and motion trajectories, when controlling virtual objects to interact with other virtual objects, the screen displayed to the user is often directly switched to the interactive screen. The switching process is not smooth, and there may also be misalignment between virtual objects, which affects the user experience. Summary of the Invention
[0004] In view of this, the embodiments of the present application provide a virtual object interaction method to solve the technical defects existing in the prior art. The embodiments of the present application also provide a virtual object interaction device, a computing device, and a computer-readable storage medium.
[0005] According to a first aspect of an embodiment of the present application, a virtual object interaction method is provided, comprising:
[0006] determining a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object;
[0007] determining, based on the interaction action information, interaction animation data of the first virtual object, an interaction motion trajectory of the second virtual object, a target interaction position of the first virtual object, and a reference interaction trajectory between the first virtual object and the second virtual object;
[0008] When the current position of the first virtual object is determined to be the target interaction position, determining a transition trajectory of the second virtual object according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory;
[0009] During the playing of the interactive animation data of the first virtual object, the second virtual object is controlled to interact with the first virtual object along the transition trajectory.
[0010] According to a second aspect of an embodiment of the present application, a virtual object interaction device is provided, comprising:
[0011] a first determining module configured to determine a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object;
[0012] a second determining module configured to determine, based on the interaction action information, interaction animation data of the first virtual object, an interaction motion trajectory of the second virtual object, a target interaction position of the first virtual object, and a reference interaction trajectory between the first virtual object and the second virtual object;
[0013] a third determining module, configured to, upon determining that the current position of the first virtual object is the target interaction position, determine a transition trajectory of the second virtual object according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory;
[0014] The control module is configured to control the second virtual object to interact with the first virtual object along the transition trajectory during the playback of the interactive animation data of the first virtual object.
[0015] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0016] memory and processor;
[0017] The memory is used to store computer-executable instructions, and the processor implements the steps of the virtual object interaction method when executing the computer-executable instructions.
[0018] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the virtual object interaction method are implemented.
[0019] According to a fifth aspect of an embodiment of the present application, a chip is provided, which stores a computer program, and when the computer program is executed by the chip, the steps of the virtual object interaction method are implemented.
[0020] The virtual object interaction method provided by the present application determines the current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and the second virtual object; based on the interaction action information, determines the interaction animation data of the first virtual object, the interaction motion trajectory of the second virtual object, the target interaction position of the first virtual object, and the reference interaction trajectory between the first virtual object and the second virtual object; when the current position of the first virtual object is determined to be the target interaction position, determines the transition trajectory of the second virtual object based on the interaction motion trajectory of the second virtual object and the reference interaction trajectory; and during the playback of the interaction animation data of the first virtual object, controls the second virtual object to interact with the first virtual object along the transition trajectory.
[0021] The above method determines that the first virtual object is located at a position where it can interact with the second virtual object, and uses the reference interaction trajectory and the interaction motion trajectory to determine the transition trajectory. During the playback of the interactive animation data of the first virtual object, the second virtual object is controlled to move along the transition trajectory and interact with the first virtual object, thereby compensating for the deviation between the position of the second virtual object and the position where the interaction can be carried out when the first virtual object and the second virtual object interact, thereby avoiding the possible misalignment between the first virtual object and the second virtual object, and by determining the transition trajectory, the transition before the interaction between the first virtual object and the second virtual object is achieved, avoiding the problem of unsmooth picture caused by instantaneous switching, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 This is a schematic diagram of an application scenario of a virtual object interaction method provided by an embodiment of the present application;
[0023] Figure 2 This is a flowchart of a virtual object interaction method provided by an embodiment of the present application;
[0024] Figure 3 is a schematic diagram of a transition trajectory in a virtual object interaction method provided by an embodiment of the present application;
[0025] Figure 4 This is a processing flow chart of a virtual object interaction method applied to a game scene provided by an embodiment of the present application;
[0026] Figure 5 This is a structural diagram of a virtual object interaction device provided by an embodiment of the present application;
[0027] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0028] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present application. Therefore, the present application is not limited to the specific implementations disclosed below.
[0029] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a", "the" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0030] It should be understood that although the terms "first," "second," and the like may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are merely used to distinguish information of the same type from one another. For example, "first" may also be referred to as "second," and similarly, "second" may also be referred to as "first," without departing from the scope of one or more embodiments of the present application.
[0031] First, the terms involved in one or more embodiments of the present invention are explained.
[0032] IK: Inverse Kinematics, is a mathematical process of calculating the joint parameters of the end of a moving joint (such as a robotic arm claw or the palm at the end of a character's skeleton arm) relative to the starting position and direction of the joint to reach the desired position.
[0033] NPC: non-player character, is a type of role in the game, meaning non-player character, refers to the game character in the electronic game that is not controlled by real players.
[0034] In actual applications, in the process of interaction between virtual objects in the game, it is usually between virtual characters and interactive virtual items. For example, the user can control the virtual character to interact with the interactive virtual items, or the NPC in the game can interact with the virtual items according to a pre-set scenario.
[0035] During the interaction between virtual objects, it is difficult to simulate the movement of interactive items using simple physics. Moreover, interactive items often need to closely follow the movement of virtual character body parts, which requires a high level of coordination between the interactive items and the virtual character. It may also happen that the interactive items are originally moving according to preset coordinates, movements, and animations in the game scene, while the virtual character needs to interact with the interactive items forcibly.
[0036] Typically, animation files for virtual characters and interactive objects are played directly to show users the interaction between the virtual characters and the interactive objects. However, this method causes the original animation of the virtual characters to instantly switch to the interactive images, resulting in a choppy display and affecting the user experience. Therefore, an effective technical solution is urgently needed to solve this problem.
[0037] This application provides a virtual object interaction method, a virtual object interaction apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.
[0038] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of a virtual object interaction method provided according to an embodiment of the present application is shown.
[0039] Figure 1 The first virtual object 102 , the second virtual object 104 , a transition trajectory 106 and a reference interaction trajectory 108 are included. The first virtual object 102 and the second virtual object 104 interact with the interaction position 110 of the second virtual object 104 . The transition trajectory 106 extends from the actual position 112 of the second virtual object 104 to the reference interaction trajectory 108 .
[0040] During specific implementation, the transition trajectory 106 can be determined based on the interactive motion trajectory of the second virtual object 104 and the reference interactive trajectory 108 between the first virtual object 102 and the second virtual object 104, so that when the interactive animation data of the first virtual object 102 is played, the second virtual object 104 is controlled to move from the actual position 112 along the transition trajectory 106 to the reference interactive trajectory 108, thereby completing the interaction between the first virtual object 102 and the second virtual object 104 and compensating for the deviation between the actual position and the interactive position.
[0041] like Figure 1As shown, the first virtual object 102 is a cat in the virtual scene, and the second virtual object 104 is a ball in the virtual scene. When controlling the cat to play with the ball, the interaction between the cat and the ball should be realized at the interaction position 110. However, the actual position 112 of the ball may deviate from the interaction position 110. In order to compensate for this deviation, when playing the animation data of the cat playing with the ball, the ball can be controlled to move from the actual position 112 along the transition trajectory 106 to the reference interaction trajectory 108, thereby completing the interactive action of the cat playing with the ball, avoiding the misalignment phenomenon caused by the interaction between the cat and the ball, and improving the authenticity and smoothness of the interactive picture.
[0042] Figure 2 A flowchart of a virtual object interaction method provided according to an embodiment of the present application is shown, which specifically includes the following steps:
[0043] Step 202: Determine a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object.
[0044] Specifically, the virtual object interaction method provided in one embodiment of the present application can be applied to game scenes. Specifically, the virtual object interaction method can be used for interaction between virtual characters and interactive items in the game, and can also be used for interaction between NPCs in the game.
[0045] In addition, the virtual object interaction method provided in an embodiment of the present application can also be applied to other scenarios, such as live broadcast scenarios, virtual concert scenarios, etc. Users can control virtual objects to interact with other virtual objects in a virtual live broadcast room or virtual concert. This application does not limit this.
[0046] For ease of understanding, the embodiments of the present application are described in detail using the virtual object interaction method applied to a game scenario as an example, but this does not affect the implementation of the virtual object interaction method in other feasible scenarios.
[0047] The virtual object interaction instruction can be understood as an instruction for instructing the interaction between a first virtual object and a second virtual object. The virtual object interaction instruction can be issued by a user, for example, a user can instruct the first virtual object and the second virtual object to interact by clicking an icon in the game. The virtual object interaction instruction can also be issued by the game, for example, an interaction instruction between preset NPCs in the game.
[0048] The first virtual object and the second virtual object can be understood as two virtual objects that interact with each other. The first virtual object can be a user-controlled virtual character, and the second virtual object can be a virtual item that the virtual character can interact with in a game. For example, if a user controls a virtual person to kick a ball, the virtual person is the first virtual object, and the ball is the second virtual object. The current position of the first virtual object can be understood as the current position of the first virtual object at the time the virtual object interaction instruction is received. For example, if the virtual person is at the goal when the interaction instruction instructs the virtual person to kick the ball is received, the goal is the current position of the virtual person.
[0049] Then the interactive action information can be understood as indicating the interactive action performed by the first virtual object and the second virtual object. For example, when the user controls the virtual person to kick a ball, "kick" is the interactive action between the first virtual object and the second virtual object.
[0050] Based on this, the current position of the first virtual object can be determined in response to an instruction indicating interaction between the first virtual object and the second virtual object.
[0051] Taking the first virtual object as a virtual person and the second virtual object as a football as an example, in response to the user's instruction to control the virtual person to kick the football, it is determined that the current position of the virtual person is at the goal.
[0052] In specific implementation, in order to facilitate the control of the interaction between the first virtual object and the second virtual object after receiving the virtual object interaction instruction, animation files corresponding to different interaction actions can be pre-made. The specific implementation method is as follows:
[0053] Determining at least one preset interaction action information between the first virtual object and the second virtual object;
[0054] Determining target preset interaction action information from the at least one preset interaction action information;
[0055] According to the preset interactive action information of the target, interactive animation data of the first virtual object and interactive animation data of the second virtual object are generated.
[0056] Among them, the preset interactive action information can be understood as a pre-set interactive action. For example, for a virtual person and a ball, the preset interactive action information can be the virtual person kicking the ball, the virtual person bouncing the ball, the virtual person throwing the ball, etc. The target preset interactive action information can be understood as each preset interactive action information in at least one preset interactive action information. The interactive animation data of the first virtual object can be understood as the animation data when the first virtual object performs the target preset interactive action. For example, when the preset interactive action information is the virtual person kicking the ball, the interactive animation data of the first virtual object is the animation data of the virtual person kicking the ball. The interactive animation data of the second virtual object can be understood as the animation data when the second virtual object performs the target preset interactive action. For example, when the preset interactive action information is the virtual person kicking the ball, the interactive animation data of the second virtual object is the animation data of the ball being kicked.
[0057] Based on this, at least one interaction action between the first virtual object and the second virtual object can be determined, and interaction animation data of the first virtual object and interaction animation data of the second virtual object corresponding to each interaction action in the at least one interaction action can be generated.
[0058] Taking the first virtual object as a virtual person and the second virtual object as a ball as an example, the interactive actions between the virtual person and the ball can be determined, including the interactive actions of the virtual person kicking the ball, the interactive actions of the virtual person dribbling the ball, and the interactive actions of the virtual person throwing the ball. In the interactive action of the virtual person kicking the ball, interactive animation data of the virtual person kicking and interactive animation data of the ball being kicked are produced. In the interactive action of the virtual person dribbling the ball, interactive animation data of the virtual person dribbling and interactive animation data of the ball being hit are produced. In the interactive action of the virtual person throwing the ball, interactive animation data of the virtual person throwing and interactive animation data of the ball being thrown are produced.
[0059] In addition, when producing the interactive animation data of the first virtual object and the interactive animation data of the second virtual object, the interactive animation data of the first virtual object and the interactive animation data of the second virtual object can be produced at the same time to maximize the presentation of the interactive animation between the first virtual object and the second virtual object.
[0060] In summary, by pre-setting at least one interactive action and producing interactive animation data of the first virtual object and the second virtual object in each interactive action, a basis is provided for playing the interactive animation data of the first virtual object and determining the motion trajectory of the second virtual object when subsequently controlling the interaction between the first virtual object and the second virtual object.
[0061] Step 204: Determine, based on the interaction action information, interaction animation data of the first virtual object, an interaction motion trajectory of the second virtual object, a target interaction position of the first virtual object, and a reference interaction trajectory between the first virtual object and the second virtual object.
[0062] Specifically, after receiving the virtual object interaction instruction, the interaction animation data of the first virtual object corresponding to the interaction action information, the interaction motion trajectory of the second virtual object, the target interaction position of the first virtual object, and the reference interaction trajectory between the first virtual object and the second virtual object can be determined based on the interaction action information carried in the virtual object interaction instruction.
[0063] The interaction animation data of the first virtual object can be understood as the animation data played when the first virtual object performs the interaction action corresponding to the interaction action information. For example, if the interaction action is a virtual person kicking a ball, the interaction animation data is the animation data of the virtual person kicking the ball. The interaction motion trajectory of the second virtual object can be understood as the motion trajectory of the second virtual object when performing the interaction action corresponding to the interaction action information. For example, if the interaction action is a virtual person kicking the ball, the interaction motion trajectory is the motion trajectory of the ball after being kicked. The target interaction position of the first virtual object can be understood as the interaction position that enables the first virtual object to perform the interaction action corresponding to the interaction action information. For example, when the distance between the first virtual object and the second virtual object reaches a preset distance threshold, the first virtual object can perform the interaction action. At this time, the position of the first virtual object is the target interaction position. The reference interaction trajectory between the first virtual object and the second virtual object can be understood as the motion trajectory of the second virtual object when the first virtual object and the second virtual object perform the interaction action. For example, if the interaction action is a virtual person kicking the ball, the motion trajectory of the ball after being kicked by the virtual person is the reference interaction trajectory between the first virtual object and the second virtual object.
[0064] It is understood that the interactive animation data of a first virtual object only includes the animation data of the first virtual object performing the interactive action. For example, for an interactive action of a virtual person kicking a ball, the interactive animation data of the virtual person includes the animation data of the virtual person kicking the ball, not the ball. Similarly, the interactive motion trajectory of a second virtual object only includes the motion trajectory of the second virtual object performing the interactive action. For example, for an interactive action of a virtual person kicking a ball, the interactive motion trajectory of the ball is the motion trajectory of the ball being kicked, not the virtual person.
[0065] Based on this, the interaction action corresponding to the interaction action information can be determined according to the interaction action information carried in the virtual object interaction instruction, and the interaction animation data of the first virtual object, the interaction motion trajectory of the second virtual object, and the reference motion trajectory of the second virtual object when the first virtual object and the second virtual object perform the interaction action can be determined.
[0066] Continuing with the above example, the interactive action information carried in the virtual object interaction instruction corresponds to the interactive action of a virtual person kicking a ball. This can determine the animation data of the virtual person kicking the ball, the motion trajectory of the ball being kicked, the target interactive position that the virtual person can achieve when kicking the ball, and the reference motion trajectory of the ball being kicked by the virtual person.
[0067] In practical applications, the interactive motion trajectory of the second virtual object can be extracted from pre-made interactive animation data of the second virtual object. The specific implementation method is as follows:
[0068] When the interaction action information matches the at least one preset interaction action information, determining, according to the interaction action information, interaction animation data of the second virtual object corresponding to the interaction action information;
[0069] An interactive motion trajectory of the second virtual object is extracted from the interactive animation data of the second virtual object.
[0070] Specifically, if it is determined that the interaction action information matches at least one preset interaction action information, the interaction animation data of the second virtual object corresponding to the interaction action information can be determined from the interaction animation data of the second virtual object corresponding to each preset interaction action information in the at least one preset interaction action information. Furthermore, the interaction motion trajectory of the second virtual object can be extracted from the interaction animation data of the second virtual object.
[0071] In addition, the interactive motion trajectory of the second virtual object corresponding to the interactive action information may also be directly generated.
[0072] Continuing with the above example, interactive animation data of a virtual person kicking a ball, a virtual person bouncing a ball, and a virtual person throwing a ball are pre-produced, and the interactive action corresponding to the interactive action information is the virtual person kicking the ball. Then, the interactive animation data of the ball being kicked corresponding to the virtual person's kicking action can be determined from the pre-produced interactive animation data, and the interactive motion trajectory of the ball being kicked can be extracted from the interactive animation data of the ball being kicked.
[0073] In summary, by determining the interactive animation data of the second virtual object corresponding to the interactive action information in the pre-made interactive animation data of the second virtual object, and extracting the interactive motion trajectory, a basis is provided for the subsequent determination of the transition trajectory, further realizing the interaction between the first virtual object and the second virtual object.
[0074] Step 206: When the current position of the first virtual object is determined to be the target interaction position, a transition trajectory of the second virtual object is determined according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory.
[0075] Specifically, after determining the target interaction position of the first virtual object, it can be determined whether the current position of the first virtual object is at the target interaction position. When it is determined that the current position of the first virtual object is at the target interaction position, the transition trajectory of the second virtual object can be determined to compensate for the deviation between the initial position of the second virtual object and the interaction position.
[0076] During specific implementation, the interactive motion trajectory of the second virtual object and the reference interactive trajectory may be fitted to obtain a transition trajectory of the second virtual object.
[0077] Specifically, performing fitting processing on the interactive motion trajectory of the second virtual object and the reference interactive trajectory to obtain a transition trajectory of the second virtual object includes:
[0078] The transition trajectory of the second virtual object is calculated by a fitting function according to the interactive motion trajectory of the second virtual object, the reference interactive trajectory and a preset transition time.
[0079] In practical applications, the fitting function may be, for example, a first-order Bessel function, as shown in the following formula (1).
[0080] P=P0*t+P1*(1-t) Formula (1)
[0081] Wherein, P is the transition trajectory, P0 is the reference interaction trajectory, P1 is the interaction motion trajectory of the second virtual object, and t is the preset transition time.
[0082] Accordingly, Figure 3 A schematic diagram of a transition trajectory in a virtual object interaction method provided according to an embodiment of the present application is shown. Figure 3 As shown, the interaction motion trajectory 302 of the second virtual object and the reference interaction trajectory 304 include a transition trajectory 306 , and the second virtual object can move along the transition trajectory 306 to the reference interaction trajectory 304 within the transition time t to achieve the transition of the second virtual object.
[0083] In summary, by using the fitting function to fit the interactive motion trajectory of the second virtual object and the reference interactive trajectory, a transition trajectory is obtained, which can provide a basis for the subsequent transition of the second virtual object, make up for the deviation between the initial position and the interactive position of the second virtual object, and further make the interaction between the first virtual object and the second virtual object smoother.
[0084] In addition, when it is determined that the current position of the first virtual object is not the target interaction position, the first virtual object is controlled to move to the target interaction position.
[0085] Specifically, when it is determined that the distance between the first virtual object and the second virtual object does not meet the preset distance threshold, it means that the first virtual object and the second virtual object are far apart and interaction cannot be achieved. The first virtual object can be controlled to move to a target interaction position where the distance between the first virtual object and the second virtual object meets the preset distance threshold, so that no misalignment will occur during subsequent interaction between the first virtual object and the second virtual object.
[0086] Furthermore, after controlling the first virtual object to move to the target interaction position, the method further includes:
[0087] The motion of the first virtual object is corrected using an inverse kinematics method.
[0088] Specifically, the inverse kinematics method can be used to determine the starting position of the joint based on the position of the end of the motion joint when the first virtual object is located at the target interaction position, thereby achieving motion correction of the first virtual object.
[0089] Taking the first virtual object as a virtual person and the interactive action as the virtual person kicking a ball as an example, the inverse kinematics method can be used to determine the position of the virtual person's ankle joint, and based on the position of the ankle joint, the position of the calf joint can be determined in reverse, and so on, until the virtual person's action correction is completed.
[0090] In summary, by correcting the motion of the first virtual object, the error in the interaction position between the first virtual object and the second virtual object can be optimized, thereby making the interaction between the first virtual object and the second virtual object smoother and further improving the authenticity of the interactive screen presentation.
[0091] Step 208: During the playback of the interactive animation data of the first virtual object, control the second virtual object to interact with the first virtual object along the transition trajectory.
[0092] Specifically, after the transition trajectory is determined, the interactive animation data of the first virtual object may be played, and during the playback process, the second virtual object may be controlled to interact with the first virtual object along the transition trajectory.
[0093] In practical applications, controlling the second virtual object to interact with the first virtual object along the transition trajectory includes:
[0094] Within a preset transition time, the second virtual object is controlled to move along the transition trajectory to the reference interaction trajectory to interact with the first virtual object.
[0095] The transition time may be understood as the time during which the second virtual object moves on the transition trajectory, which is preset according to actual needs.
[0096] As mentioned above Figure 3 As shown, the second virtual object can be controlled to move along the transition trajectory 306 to the reference interaction trajectory 304 within a preset transition time.
[0097] In summary, by setting the transition time, the second virtual object can be controlled to move from the transition trajectory to the reference interaction trajectory, thereby improving the interaction smoothness between the first virtual object and the second virtual object.
[0098] In addition, the second virtual object is controlled to move along the transition trajectory to the reference interaction trajectory. After interacting with the first virtual object, in order to ensure that the second virtual object can naturally escape from the reference interaction trajectory, a simulated inertia force may be set for the second virtual object. The specific implementation method is as follows:
[0099] determining a first position and a second position of the second virtual object on the reference interaction trajectory;
[0100] determining a movement speed of the second virtual object according to the first position and the second position;
[0101] determining a simulated inertial force of the second virtual object according to the movement speed;
[0102] The movement of the second virtual object is controlled according to the simulated inertial force.
[0103] The second virtual object being at the first position of the reference interaction trajectory can be understood as the second virtual object being at the position of the reference interaction trajectory when the interactive animation data of the first virtual object is played to the last frame. The second virtual object being at the second position of the reference interaction trajectory can be understood as the second virtual object being at the position of the reference interaction trajectory when the interactive animation data of the first virtual object is played to the frame before the last frame.
[0104] Based on this, the first and second positions of the second virtual object in the reference interaction trajectory can be determined. The current motion speed of the second virtual object is calculated based on the difference between the first and second positions. The simulated inertial force of the second virtual object is then calculated based on the current motion speed and a preset inertia coefficient. After the interactive animation data of the first virtual object is played, the second virtual object is controlled to continue moving using the simulated inertial force.
[0105] In actual applications, a rigid body can be added to the second virtual object in the game development engine. After adding the rigid body, the second virtual object can be affected by the simulated natural force, thereby controlling the second virtual object to continue moving by simulating inertial force.
[0106] Taking a virtual person kicking a ball as an example, determine the position of the ball on the reference interactive trajectory when the interactive animation data of the virtual person kicking the ball is played to the frame before the last frame, and the position of the ball on the reference interactive trajectory when the interactive animation data of the virtual person kicking the ball is played to the last frame. Based on the position difference between the two positions, calculate the current movement speed of the ball, multiply the current movement speed and the preset inertia coefficient to calculate the simulated inertia force of the ball, and control the ball to continue moving with the simulated inertia force until the ball stops naturally under the simulated inertia force.
[0107] In summary, by calculating the simulated inertial force for the second virtual object and controlling the movement of the second virtual object according to the simulated inertial force, the second virtual object can naturally deviate from the reference interaction trajectory according to inertia, further improving the smoothness and naturalness of the interaction screen.
[0108] To sum up, the above method determines that the first virtual object is located at a position where it can interact with the second virtual object, and uses the reference interaction trajectory and the interaction motion trajectory to determine the transition trajectory. During the playing of the interactive animation data of the first virtual object, the second virtual object is controlled to move along the transition trajectory and interact with the first virtual object, thereby compensating for the deviation between the position of the second virtual object and the position where the interaction can be carried out when the first virtual object and the second virtual object interact, thereby avoiding the possible misalignment between the first virtual object and the second virtual object, and by determining the transition trajectory, the transition before the interaction between the first virtual object and the second virtual object is realized, avoiding the problem of unsmooth picture caused by instantaneous switching, thereby improving the user experience.
[0109] The following combined Figure 4 Taking the application of the virtual object interaction method provided in this application to a game scene as an example, the virtual object interaction method is further explained. Figure 4 A processing flow chart of a virtual object interaction method applied to a game scene provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0110] Step 402: In response to a virtual object interaction instruction, determine the current position of the first virtual object, wherein the interaction instruction carries interaction action information between the first virtual object and the second virtual object; and based on the interaction action information, determine the interaction animation data of the first virtual object, the interaction motion trajectory of the second virtual object, the target interaction position of the first virtual object, and the reference interaction trajectory between the first virtual object and the second virtual object.
[0111] Specifically, taking the interaction between a cat in a game scene as an example, and a ball in the game scene as the second virtual object, the cat and the ball can be interacted with. In the preparation phase, the interactive action for controlling the cat and the ball carried in the interaction instruction can be determined, as well as the interactive animation data of the cat when the cat plays with the ball, the interactive motion trajectory of the ball when the cat plays with the ball, the target interaction position that enables the cat to complete the interactive action of the cat playing with the ball, and the reference interaction trajectory when the cat plays with the ball.
[0112] Step 404: When it is determined that the current position of the first virtual object is not the target interaction position, the first virtual object is controlled to move to the target interaction position, and the motion of the first virtual object is corrected using an inverse motion method.
[0113] Specifically, when it is determined that the cat's position is not in the target interaction position that enables the cat to complete the cat playing with the ball interaction action, the cat is controlled to move to the target interaction position, and the cat's action is corrected using the inverse motion method to obtain the corrected cat's action and position.
[0114] Step 406: When the current position of the first virtual object is determined to be the target interaction position, the interaction trajectory of the second virtual object is fitted to the reference interaction trajectory to determine a transition trajectory for the second virtual object. During playback of the interaction animation data of the first virtual object, the second virtual object is controlled to move along the transition trajectory to the reference interaction trajectory within a preset transition time to interact with the first virtual object.
[0115] Specifically, in the interaction stage, when it is determined that the cat is at the target interaction position, the ball's interactive motion trajectory and the reference interaction trajectory of the cat playing with the ball are fitted to determine the ball's transition trajectory, so that the ball's position is adsorbed from the transition trajectory to the reference interaction trajectory, completing the interaction between the cat and the ball.
[0116] Step 408: Determine the first position and the second position of the second virtual object in the reference interaction trajectory; determine the movement speed of the second virtual object based on the first position and the second position; determine the simulated inertial force of the second virtual object based on the movement speed; and control the movement of the second virtual object based on the simulated inertial force.
[0117] Specifically, in the ending stage, in order to enable the ball to continue its inertial motion at a certain speed, the simulated inertial force of the ball can be determined, and a rigid body can be added to the ball using the game development engine so that the ball can be affected by the simulated forces in nature, and according to the simulated inertial force, the ball can be controlled to continue its inertial motion.
[0118] To sum up, the above method determines that the first virtual object is located at a position where it can interact with the second virtual object, and uses the reference interaction trajectory and the interaction motion trajectory to determine the transition trajectory. During the playing of the interactive animation data of the first virtual object, the second virtual object is controlled to move along the transition trajectory and interact with the first virtual object, thereby compensating for the deviation between the position of the second virtual object and the position where the interaction can be carried out when the first virtual object and the second virtual object interact, thereby avoiding the possible misalignment between the first virtual object and the second virtual object, and by determining the transition trajectory, the transition before the interaction between the first virtual object and the second virtual object is realized, avoiding the problem of unsmooth picture caused by instantaneous switching, thereby improving the user experience.
[0119] Corresponding to the above method embodiment, the present application also provides a virtual object interaction device embodiment, Figure 5 FIG. 1 shows a schematic diagram of the structure of a virtual object interaction device provided by an embodiment of the present application. Figure 5 As shown, the device includes:
[0120] A first determining module 502 is configured to determine a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object;
[0121] A second determining module 504 is configured to determine, based on the interaction action information, interaction animation data of the first virtual object, an interaction motion trajectory of the second virtual object, a target interaction position of the first virtual object, and a reference interaction trajectory between the first virtual object and the second virtual object;
[0122] a third determining module 506 configured to, upon determining that the current position of the first virtual object is the target interaction position, determine a transition trajectory of the second virtual object according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory;
[0123] The control module 508 is configured to control the second virtual object to interact with the first virtual object along the transition trajectory during the playback of the interaction animation data of the first virtual object.
[0124] In an optional embodiment, the third determining module 506 is further configured to:
[0125] Fitting is performed on the interactive motion trajectory of the second virtual object and the reference interactive trajectory to obtain a transition trajectory of the second virtual object.
[0126] In an optional embodiment, the third determining module 506 is further configured to:
[0127] The transition trajectory of the second virtual object is calculated by a fitting function according to the interactive motion trajectory of the second virtual object, the reference interactive trajectory and a preset transition time.
[0128] In an optional embodiment, the apparatus further includes a production module configured to:
[0129] Determining at least one preset interaction action information between the first virtual object and the second virtual object;
[0130] Determining target preset interaction action information from the at least one preset interaction action information;
[0131] According to the preset interactive action information of the target, interactive animation data of the first virtual object and interactive animation data of the second virtual object are generated.
[0132] In an optional embodiment, the second determining module 504 is further configured to:
[0133] When the interaction action information matches the at least one preset interaction action information, determining, according to the interaction action information, interaction animation data of the second virtual object corresponding to the interaction action information;
[0134] An interactive motion trajectory of the second virtual object is extracted from the interactive animation data of the second virtual object.
[0135] In an optional embodiment, the control module 508 is further configured to:
[0136] Within a preset transition time, the second virtual object is controlled to move along the transition trajectory to the reference interaction trajectory to interact with the first virtual object.
[0137] In an optional embodiment, the control module 508 is further configured to:
[0138] determining a first position and a second position of the second virtual object on the reference interaction trajectory;
[0139] determining a movement speed of the second virtual object according to the first position and the second position;
[0140] determining a simulated inertial force of the second virtual object according to the movement speed;
[0141] The movement of the second virtual object is controlled according to the simulated inertial force.
[0142] In an optional embodiment, the control module 508 is further configured to:
[0143] When it is determined that the current position of the first virtual object is not the target interaction position, the first virtual object is controlled to move to the target interaction position.
[0144] In an optional embodiment, the apparatus further includes a correction module configured to:
[0145] The motion of the first virtual object is corrected using an inverse kinematics method.
[0146] The above-mentioned device determines a transition trajectory by using a reference interaction trajectory and an interaction motion trajectory when determining that the first virtual object is located at a position where it can interact with the second virtual object. During the playback of the interactive animation data of the first virtual object, the second virtual object is controlled to move along the transition trajectory and interact with the first virtual object, thereby compensating for the deviation between the position of the second virtual object and the position where the interaction can be carried out when the first virtual object and the second virtual object interact, thereby avoiding the possible misalignment between the first virtual object and the second virtual object, and by determining the transition trajectory, a transition is achieved before the first virtual object and the second virtual object interact, avoiding the problem of unsmooth picture caused by instantaneous switching, thereby improving the user experience.
[0147] The above is a schematic scheme of a virtual object interaction device of this embodiment. It should be noted that the technical solution of the virtual object interaction device and the technical solution of the above-mentioned virtual object interaction method belong to the same concept. For details that are not described in detail in the technical solution of the virtual object interaction device, please refer to the description of the technical solution of the above-mentioned virtual object interaction method. In addition, the various components in the device embodiment should be understood as functional modules that must be established to implement each step of the program flow or each step of the method, and each functional module is not an actual functional division or separation definition. The device claim defined by such a group of functional modules should be understood as a functional module architecture that mainly implements the solution through the computer program recorded in the specification, and should not be understood as a physical device that mainly implements the solution through hardware.
[0148] Figure 6 6 shows a block diagram of a computing device 600 according to one embodiment of the present disclosure. Components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0149] The computing device 600 also includes an access device 640 that enables the computing device 600 to communicate via one or more networks 660. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of network interface (e.g., a network interface card (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0150] In one embodiment of the present application, the above components of the computing device 600 and Figure 6 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 6 The computing device structure block diagram shown is for illustrative purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0151] Computing device 600 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 600 may also be a mobile or stationary server.
[0152] The processor 620 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-mentioned virtual object interaction method.
[0153] The above is a schematic diagram of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the aforementioned virtual object interaction method are based on the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the aforementioned virtual object interaction method.
[0154] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which are used in a virtual object interaction method when executed by a processor.
[0155] The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the aforementioned virtual object interaction method are based on the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the aforementioned virtual object interaction method.
[0156] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0157] An embodiment of the present application further provides a chip storing a computer program, which implements the steps of the virtual object interaction method when executed by the chip.
[0158] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0159] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0160] The preferred embodiments of the present application disclosed above are intended only to help illustrate the present application. The optional embodiments do not describe all details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of this application. This application selects and describes these embodiments in detail in order to better explain the principles and practical applications of this application, so that those skilled in the art can better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. A virtual object interaction method, characterized in that: include: determining a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object; Determining, based on the interactive action information, interactive animation data of the first virtual object, an interactive motion trajectory of the second virtual object, a target interactive position of the first virtual object, and a reference interactive trajectory between the first virtual object and the second virtual object, wherein the interactive motion trajectory is a motion trajectory of the second virtual object when performing the interactive action corresponding to the interactive action information, the target interactive position is an interactive position at which the first virtual object can perform the interactive action corresponding to the interactive action information, and the reference interactive trajectory is a motion trajectory of the second virtual object when the first virtual object and the second virtual object perform the interactive action; the interactive animation data only includes animation data of the first virtual object performing the interactive action, and the interactive motion trajectory only includes a motion trajectory of the second virtual object performing the interactive action; When the current position of the first virtual object is determined to be the target interaction position, determining a transition trajectory of the second virtual object according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory; During the playing of the interactive animation data of the first virtual object, the second virtual object is controlled to interact with the first virtual object along the transition trajectory.
2. The method according to claim 1, characterized in that The determining, according to the interactive motion trajectory of the second virtual object and the reference interactive trajectory, a transition trajectory of the second virtual object includes: Fitting is performed on the interactive motion trajectory of the second virtual object and the reference interactive trajectory to obtain a transition trajectory of the second virtual object.
3. The method according to claim 2, characterized in that The fitting process of the interactive motion trajectory of the second virtual object and the reference interactive trajectory to obtain a transition trajectory of the second virtual object includes: The transition trajectory of the second virtual object is calculated by a fitting function according to the interactive motion trajectory of the second virtual object, the reference interactive trajectory and a preset transition time.
4. The method according to claim 1, wherein Before responding to the virtual object interaction instruction, the method further includes: Determining at least one preset interaction action information between the first virtual object and the second virtual object; Determining target preset interaction action information from the at least one preset interaction action information; According to the preset interactive action information of the target, interactive animation data of the first virtual object and interactive animation data of the second virtual object are generated.
5. The method according to claim 4, characterized in that The determining, according to the interactive action information, an interactive motion trajectory of the second virtual object includes: When the interaction action information matches the at least one preset interaction action information, determining, according to the interaction action information, interaction animation data of the second virtual object corresponding to the interaction action information; An interactive motion trajectory of the second virtual object is extracted from the interactive animation data of the second virtual object.
6. The method according to claim 1, wherein controlling the second virtual object to interact with the first virtual object along the transition trajectory comprises: Within a preset transition time, the second virtual object is controlled to move along the transition trajectory to the reference interaction trajectory to interact with the first virtual object.
7. The method according to claim 6, wherein after controlling the second virtual object to move along the transition trajectory to the reference interaction trajectory and interacting with the first virtual object, further comprising: determining a first position and a second position of the second virtual object on the reference interaction trajectory; determining a movement speed of the second virtual object according to the first position and the second position; determining a simulated inertial force of the second virtual object according to the movement speed; The movement of the second virtual object is controlled according to the simulated inertial force.
8. The method according to claim 1, further comprising: When it is determined that the current position of the first virtual object is not the target interaction position, the first virtual object is controlled to move to the target interaction position.
9. The method according to claim 8, further comprising: The motion of the first virtual object is corrected using an inverse kinematics method.
10. The method according to claim 1, characterized in that The virtual object interaction method is applied to game scenes.
11. A virtual object interaction device, characterized in that: include: a first determining module configured to determine a current position of a first virtual object in response to a virtual object interaction instruction, wherein the interaction instruction carries interaction action information between the first virtual object and a second virtual object; a second determining module configured to determine, based on the interactive action information, interactive animation data of the first virtual object, an interactive motion trajectory of the second virtual object, a target interactive position of the first virtual object, and a reference interactive trajectory between the first virtual object and the second virtual object, wherein the interactive motion trajectory is a motion trajectory of the second virtual object when performing the interactive action corresponding to the interactive action information, the target interactive position is an interactive position at which the first virtual object can perform the interactive action corresponding to the interactive action information, and the reference interactive trajectory is a motion trajectory of the second virtual object when the first virtual object and the second virtual object perform the interactive action; the interactive animation data only includes animation data of the first virtual object performing the interactive action, and the interactive motion trajectory only includes a motion trajectory of the second virtual object performing the interactive action; a third determining module, configured to, upon determining that the current position of the first virtual object is the target interaction position, determine a transition trajectory of the second virtual object according to the interaction motion trajectory of the second virtual object and the reference interaction trajectory; The control module is configured to control the second virtual object to interact with the first virtual object along the transition trajectory during the playback of the interactive animation data of the first virtual object.
12. A computing device, characterized in that include: memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the virtual object interaction method according to any one of claims 1 to 10.
13. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by the processor, the steps of the virtual object interaction method described in any one of claims 1 to 10 are implemented.
Citation Information
Patent Citations
Animation processing method and device in game, electronic equipment and storage medium
CN111494954A
Virtual object pose control method and device and computer storage medium
CN112774203A