Location updating method and device
By obtaining the mapping position of the target bones of the virtual character on the dynamic contact surface and establishing positional relationships, the problem of virtual characters not being realistic in the dynamic environment is solved, and a more realistic gaming experience is achieved.
Patent Information
- Application Number
- CN202111479435.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-08-19
- Estimated Expiration
- 2041-12-06
AI Technical Summary
When handling dynamic contact surfaces, the fitting effect between virtual characters and contact surfaces is unreal, resulting in shaking and unnatural movement of game characters in dynamic environments.
By obtaining the target bone position of the virtual character, determining its mapping position on the dynamic contact surface, and establishing a position relationship between the virtual character and the dynamic contact surface, the position of the virtual character is updated according to the relationship when the dynamic contact surface moves to ensure that it remains in line with the dynamic contact surface.
It realizes the real movement effect of virtual characters on the dynamic contact surface, improving the realism and user experience in the game.
Smart Images

Figure CN114100138B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a location updating method and device. Background Art
[0002] With the development of Internet technology, users have higher and higher requirements for the realism of games. In order to provide users with a better gaming experience, major game manufacturers will continuously update their games during the game development, testing, and release stages. In the existing technology, IK technology is a widely used method. Its purpose is to make the game character fit the actual game environment more realistically. Its principle is to complete the detection by making rays from the character's foot slot downward. However, when the contact surface that the game character needs to touch is dynamic, the existing IK technology may not be able to achieve a reasonable effect, and due to the dynamic changes in the contact surface, the game character will not have a realistic display effect relative to the dynamic contact surface. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention
[0003] In view of this, the embodiments of the present application provide a location updating method to solve the technical defects existing in the prior art. The embodiments of the present application also provide a location updating apparatus, a computing device, and a computer-readable storage medium.
[0004] According to a first aspect of an embodiment of the present application, a location updating method is provided, including:
[0005] Get the bone position corresponding to the target bone of the virtual character;
[0006] Determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position;
[0007] establishing a positional relationship between the virtual character and the dynamic contact surface based on the mapped position;
[0008] When the dynamic contact surface moves relative to the virtual character, the position of the virtual character is updated according to the positional relationship.
[0009] Optionally, obtaining the bone position corresponding to the target bone of the virtual character includes:
[0010] Selecting a target character bone that is closest to the dynamic contact surface from the character bones corresponding to the virtual character as the target bone;
[0011] Determine a world coordinate system to which the virtual character belongs, and determine a bone position corresponding to the target bone based on the world coordinate system.
[0012] Optionally, before the step of obtaining the bone position corresponding to the target bone of the virtual character is performed, the method further includes:
[0013] In a case where there is an inclination angle between the virtual character and the dynamic contact surface, rotating the virtual character according to the inclination angle;
[0014] The rotated virtual character is perpendicular to the dynamic contact surface.
[0015] Optionally, determining a mapping position of the target bone mapping on the dynamic contact surface according to the bone position includes:
[0016] creating a guide line between the bone position and the dynamic contact surface;
[0017] A contact point is determined based on an intersection of the dynamic contact surface and the auxiliary line, and a position of the contact point is used as the mapped position.
[0018] Optionally, establishing a positional relationship between the virtual character and the dynamic contact surface based on the mapped position includes:
[0019] Determining a contact position corresponding to the virtual character on the dynamic contact surface, and determining a coordinate system corresponding to the contact position;
[0020] Determining mapping coordinate information corresponding to the mapping position and contact coordinate information corresponding to the contact position in the coordinate system;
[0021] Calculating an offset between the contact position and the mapped position according to the mapped coordinate information and the contact coordinate information;
[0022] The positional relationship between the virtual character and the dynamic contact surface is determined based on the offset.
[0023] Optionally, updating the position of the virtual character according to the position relationship includes:
[0024] Determine the initial position of the target bone in the world coordinate system in the current animation frame;
[0025] The initial position is adjusted based on the positional relationship, and the position of the virtual character in the current animation frame is updated according to the adjustment result.
[0026] Optionally, after the step of updating the position of the virtual character according to the position relationship is performed, the method further includes:
[0027] Determining a motion cycle of the dynamic contact surface, and splicing animation frames within the motion cycle in chronological order;
[0028] A target animation including the virtual character and the dynamic contact surface is generated and displayed according to the splicing result.
[0029] Optionally, after the step of obtaining the bone position corresponding to the target bone of the virtual character is performed, the method further includes:
[0030] determining a deflection angle between the virtual character and the dynamic contact surface;
[0031] The angular relationship between the virtual character and the dynamic contact surface is adjusted according to the deflection angle.
[0032] Optionally, determining a deflection angle between the virtual character and the dynamic contact surface includes:
[0033] Determining a parent bone corresponding to the contact position in the dynamic contact surface;
[0034] A target deflection angle between the parent bone and the contact bone to which the contact position belongs is determined as a deflection angle between the virtual character and the dynamic contact surface.
[0035] According to a second aspect of an embodiment of the present application, a location updating apparatus is provided, including:
[0036] An acquisition module is configured to acquire a bone position corresponding to a target bone of the virtual character;
[0037] a determination module configured to determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position;
[0038] an establishing module configured to establish a positional relationship between the virtual character and the dynamic contact surface based on the mapped position;
[0039] The updating module is configured to update the position of the virtual character according to the positional relationship when the dynamic contact surface moves relative to the virtual character.
[0040] According to a third aspect of an embodiment of the present application, a computing device is provided, including:
[0041] memory and processor;
[0042] The memory is used to store computer-executable instructions, and the processor implements the steps of the location updating method when executing the computer-executable instructions.
[0043] 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 location updating method are implemented.
[0044] According to a fifth aspect of the embodiments 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 location update method are implemented.
[0045] The position updating method provided by the present application, in order to enable the virtual character to move along with the movement of the dynamic contact surface, after obtaining the bone position corresponding to the target bone of the virtual character, the mapping position of the target bone mapping on the dynamic contact surface can be determined according to the bone position, and then the positional relationship between the virtual character and the dynamic contact surface is established based on the mapping position. When the dynamic contact surface moves relative to the virtual character, the position of the virtual character can be updated according to the position of the contact point on the dynamic contact surface according to the positional relationship, so that when the dynamic contact surface moves, the virtual character in contact with the dynamic contact surface can move together, and the fit between the virtual character and the dynamic contact surface can be guaranteed through the positional relationship, thereby presenting a more realistic virtual scene to the user. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 This is a flow chart of a location updating method provided by an embodiment of the present application;
[0047] Figure 2 1 is a schematic diagram of location updating in a location updating method provided in one embodiment of the present application;
[0048] Figure 3 This is a processing flow chart of a position updating method applied to a game scene provided by an embodiment of the present application;
[0049] Figure 4 This is a structural diagram of a location updating device provided by an embodiment of the present application;
[0050] Figure 5 This is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0051] 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.
[0052] 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.
[0053] 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.
[0054] This application provides a location updating method, a location updating apparatus, a computing device, and a computer-readable storage medium, which are described in detail in the following embodiments.
[0055] In practice, 3D artists typically create animations based on a horizontal surface. However, in-game terrain is often complex, with various elevations and elevations, as well as environmental elements like small rocks and wooden boxes. This means that characters moving in-game encounter an extremely complex geographical environment. Foot IK technology is designed to help characters more realistically fit into this complex environment.
[0056] In gameplay, character collisions are based on the physical collisions of the capsule. When the capsule is lifted by the collision box of another object, the character's feet will appear to float. At this time, a ray trace is performed downward along the world's Z axis from the character's foot socket. The difference between the actual ground height and the height of the capsule bottom is the distance the foot needs to compensate. The compensation distance may be different for each foot, and the pelvis is adjusted with the lower difference as the target value, thereby achieving the goal of fitting the character's feet to the actual ground by adjusting the character's mesh bones.
[0057] However, when the terrain beneath your feet is dynamic, existing IK techniques fail to achieve optimal results. Because the contact surface is dynamic, the character capsule's contact with it will vibrate due to the constant updates in the physics collision calculations caused by the movement of the contact surface. The actual height of the raycast return from the foot socket is also uncertain and constantly changing, causing the foot bones to constantly adjust, and this adjustment is unrelated to the movement of the contact surface.
[0058] In view of this, the position updating method provided by the present application, in order to enable the virtual character to move along with the movement of the dynamic contact surface, after obtaining the bone position corresponding to the target bone of the virtual character, the mapping position of the target bone mapping on the dynamic contact surface can be determined according to the bone position, and then the positional relationship between the virtual character and the dynamic contact surface is established based on the mapping position. When the dynamic contact surface moves relative to the virtual character, the position of the virtual character can be updated according to the position of the contact point on the dynamic contact surface according to the positional relationship, so that when the dynamic contact surface moves, the virtual character in contact with the dynamic contact surface can move together, and the fit between the virtual character and the dynamic contact surface can be guaranteed through the positional relationship, thereby presenting a more realistic virtual scene to the user.
[0059] Figure 1 A flowchart of a location updating method according to an embodiment of the present application is shown, which specifically includes the following steps:
[0060] Step S102: Obtain the bone position corresponding to the target bone of the virtual character.
[0061] Specifically, a virtual character refers to a character that needs to be displayed through a terminal device, including but not limited to game characters in game scenes, interactive characters in VR scenes, simulated characters in human-computer interaction scenes, etc. Correspondingly, a target bone refers to the bones in the character skeleton of the virtual character that need to contact the contact surface, including but not limited to foot bones, hand bones, pelvic bones, etc.; when the virtual character stands on the contact surface, the target bone can be the foot bone; when the virtual character uses his hands to support the ground and does an upside-down stand, the target bone can be the hand bone; when the virtual character sits on the contact surface, the target bone can be the pelvic bone. Correspondingly, the bone position specifically refers to the position of the target bone in the world coordinate system to which the virtual character belongs.
[0062] This embodiment takes the virtual character as a game character in a game scene as an example to illustrate the position update method. The description content in other application scenarios can refer to the same or corresponding description content in this embodiment, and will not be elaborated here.
[0063] Based on this, in order to ensure that when the virtual character contacts the dynamic contact surface, it can show a real contact effect and move with the movement of the dynamic contact surface, the target bone that the virtual character needs to contact with the dynamic contact surface can be determined first, and the subsequent position adjustment can be made based on the bone position of the target bone to ensure that when the dynamic contact surface contacts the target bone, it can meet the real contact effect and the two can move together, thereby providing players with a more realistic gaming experience.
[0064] Furthermore, considering that the virtual character includes multiple character skeletons when being created, when the virtual character contacts the dynamic contact surface, in order to ensure that the skeleton in contact with the dynamic contact surface has a more realistic contact effect with the dynamic contact surface, a target skeleton can be selected from the multiple character skeletons and its corresponding skeleton position can be determined. In this embodiment, the specific implementation method is as follows:
[0065] Selecting a target character bone that is closest to the dynamic contact surface from the character bones corresponding to the virtual character as the target bone;
[0066] Determine a world coordinate system to which the virtual character belongs, and determine a bone position corresponding to the target bone based on the world coordinate system.
[0067] Specifically, the character skeleton specifically refers to all the skeletons corresponding to the virtual character, including but not limited to the virtual character's foot bones, hand bones, pelvic bones, head bones, etc. Correspondingly, the target character skeleton specifically refers to the character skeleton that is closest to the dynamic contact surface, wherein the distance between the character skeleton and the dynamic contact surface is the straight-line distance between the two. Correspondingly, the dynamic contact surface specifically refers to the surface that carries the virtual character in the game scene, and the surface will change due to settings, such as fluctuating water surface, mud pit, etc., or elements on which the game character can stand, such as bamboo, branches, etc., that is, a surface on which the virtual character can stand and move. Correspondingly, the world coordinate system specifically refers to the coordinate system covering the entire game scene, and any virtual object in the game scene has corresponding coordinate information in this coordinate system.
[0068] Based on this, in order to be able to support the virtual character to move along with the movement of the dynamic base surface in the future, it is necessary to first establish the positional relationship between the dynamic base surface and the virtual character. Therefore, in order to ensure that the virtual character will not be deformed when the position of the virtual character is adjusted in the future, a target character bone with a suitable distance from the dynamic contact surface can be selected as the target bone in the character skeleton of the virtual character, such as selecting the target character bone closest to the dynamic contact surface as the target bone; then determine the world coordinate system to which the virtual character belongs, and determine the bone position corresponding to the target bone in the coordinate system, so as to facilitate the subsequent position adjustment of the virtual character in combination with the bone position, thereby ensuring the authenticity of the contact between the virtual character and the dynamic contact surface, and the two can move together.
[0069] In addition, considering that the dynamic contact surface that the virtual character contacts has an inclined angle, if the virtual character stands on the dynamic contact surface with an inclined angle, if the virtual character's standing angle is not adjusted, the final display effect will result in the virtual character's feet not being able to fit the dynamic contact surface; therefore, when the dynamic contact surface has an inclined angle, the virtual character's standing angle needs to be adjusted. In this embodiment, the specific implementation method is as follows:
[0070] In a case where there is an inclination angle between the virtual character and the dynamic contact surface, the virtual character is rotated according to the inclination angle; wherein the rotated virtual character is perpendicular to the dynamic contact surface.
[0071] Specifically, the tilt angle refers to the angle between the virtual character and the dynamic contact surface at the current moment. Therefore, if there is a tilt angle between the virtual character and the dynamic contact surface, and that tilt angle is not equal to 90 degrees, the difference between the tilt angle and 90 degrees can be calculated. The virtual character is then rotated based on this difference to ensure that the rotated virtual character is perpendicular to the dynamic contact surface, facilitating subsequent adjustments to the virtual character's height relative to the dynamic contact surface.
[0072] For example, if a game character needs to stand on a lake in a game scene, the character mesh can be rotated based on the angle difference between the character and the lake in the current frame, so that the character is perpendicular to the lake in the current frame. Furthermore, if the game character is standing on the lake in the current frame and the distance between the character's foot bones and the lake is determined to be closest, the corresponding bone position of the foot bones in the game character's world coordinate system can be determined to facilitate subsequent adjustment of the height between the game character and the lake surface, so that the game character can swing with the fluctuations of the lake surface.
[0073] In summary, considering that a dynamic contact surface with an inclined angle affects the standing effect of the virtual character, the virtual character can be rotated according to the inclination angle of the dynamic contact surface, thereby ensuring that the virtual character is perpendicular to the dynamic contact surface in any frame, so as to improve the authenticity of the contact between the two, and the position adjustment can be completed based on this in the future.
[0074] Step S104: determining the mapping position of the target bone on the dynamic contact surface according to the bone position.
[0075] Specifically, after the above-mentioned skeletal position of the target skeleton is obtained, further, in order to ensure that the virtual character is more fitted when in contact with the dynamic contact surface, and the virtual character will not be deformed, the mapping position of the target skeleton can be determined in conjunction with the skeletal position of the target skeleton to be mapped on the contact surface, so as to facilitate the subsequent adjustment of the height of the virtual character relative to the dynamic contact surface in conjunction with the mapping position, and establish the positional relationship between the two, so as to ensure that the virtual character can also move together when the dynamic contact surface moves. Wherein, the mapping position specifically refers to the position corresponding to the mapping point after the position where the target skeleton is located is mapped to the dynamic contact surface. The distance that the current frame virtual character needs to move relative to the dynamic contact surface can be calculated by the mapping position.
[0076] Furthermore, in the process of determining the mapping position based on the skeletal position of the target bone, considering that there may be a positive / negative distance between the position of the target bone and the dynamic contact surface, it is necessary to complete the determination of the mapping position by creating auxiliary lines. In this embodiment, the specific implementation is as follows:
[0077] creating a guide line between the bone position and the dynamic contact surface;
[0078] A contact point is determined based on an intersection of the dynamic contact surface and the auxiliary line, and a position of the contact point is used as the mapped position.
[0079] Specifically, the auxiliary line refers to a ray drawn from the bone position to the dynamic contact surface; correspondingly, the contact point refers to the only point where the auxiliary line contacts the contact surface, indicating that when the virtual character is in close contact with the dynamic contact surface, the bone position of the virtual character is close to the target bone of the virtual character.
[0080] Based on this, in order to ensure the accuracy of determining the mapping position, the bone position of the target bone can be determined according to the target bone position, and a ray can be made from the bone position as the starting point in the direction of the dynamic contact surface in the current frame. The mapping position can be determined according to the contact point between the ray and the dynamic contact surface, so as to facilitate the subsequent adjustment of the distance between the virtual character and the dynamic contact surface in combination with the mapping position, and ensure that the two are relatively parallel. The parallel relationship can be maintained in each frame, and the distance remains unchanged, showing the display effect that the virtual character moves with the movement of the dynamic contact surface.
[0081] It should be noted that the target bone of the virtual character may be located above or below the dynamic contact surface in the current frame due to game settings. Therefore, when establishing auxiliary lines, it is necessary to draw a ray from the target bone to the dynamic contact surface to accurately determine the mapping position.
[0082] Continuing with the previous example, after determining that the game character is standing on the lake in the current frame, a ray is drawn from the game character's foot slot position to the lake surface in the current frame. The mapping position of the foot bone on the lake surface is determined based on the contact point between the ray and the lake surface. This mapping position is used as the target position of the foot IK, which facilitates the subsequent dynamic adjustment of the game character's position in each frame.
[0083] In summary, by using auxiliary lines to determine the mapping position, the accuracy of the mapping position can be guaranteed, so that the virtual character can be adjusted based on the mapping position in the future, ensuring that the positional relationship between the dynamic contact surface and the virtual character can be maintained in each frame, thereby improving the display effect.
[0084] In addition, in order to achieve a reasonable target skeleton posture of the virtual character, a suitable offset angle is selected according to the contact surface, for example, parallel to the contact surface, and the deflection angle between the virtual character and the dynamic contact surface is adjusted based on the deflection angle. In this embodiment, the specific implementation method is as follows: Steps S1042 to S1044:
[0085] Step S1042: determining a deflection angle between the virtual character and the dynamic contact surface.
[0086] Specifically, the deflection angle refers to adjusting the angle of the virtual character relative to the dynamic contact surface. The adjusted deflection angle can make the positional relationship between the virtual character and the dynamic contact surface more consistent with the real scene.
[0087] Furthermore, when determining the deflection angle between the virtual character and the dynamic contact surface, the parent bone of the contact position may be combined for determination. In this embodiment, the specific implementation is as follows:
[0088] Determining a parent bone corresponding to the contact position in the dynamic contact surface;
[0089] A target deflection angle between the parent bone and the contact bone to which the contact position belongs is determined as a deflection angle between the virtual character and the dynamic contact surface.
[0090] Specifically, the parent bone refers to the bone to which the contact position is connected. For example, if the contact bone is the third section of a bamboo, the parent bone would be the second section. Or, if the contact bone is the tip of a sword, the parent bone would be the blade. Accordingly, the target deflection angle refers to the angle of deviation from the contact position's parent bone's direction of sight toward the contact point.
[0091] That is to say, after the deflection angle is determined, the deflection angle can be used as the deflection angle of the target skeleton of the virtual character. That is, after the target deflection angle is determined, the target skeleton of the virtual character can be rotated according to the target deflection angle.
[0092] In summary, by using the parent bone of the target bone to adjust the angle of the virtual character relative to the dynamic contact surface, the angle deflection of the virtual character as a whole can be completed, which not only improves the positional relationship between the dynamic contact surface and the virtual character in each subsequent frame, but also improves the display effect.
[0093] In addition, when calculating the deflection angle, in order to ensure the flexibility of the virtual character, the deflection angle can also be determined based on the normal direction of the dynamic contact surface, or the virtual character can be parallel to the dynamic contact surface. In actual applications, the appropriate method can be selected to calculate the deflection angle according to actual needs, and this embodiment does not impose any restrictions here.
[0094] Step S1044: adjusting the angle relationship between the virtual character and the dynamic contact surface according to the deflection angle.
[0095] Based on this, since the virtual character as a whole needs to be adjusted in position later, and the target bone is the bone closest to the dynamic contact surface, if the position of the virtual character is corrected according to the target bone, it may cause the virtual character to deform, and there will also be the problem of insufficient correction angle. Therefore, in order to ensure that the virtual character is perpendicular to the dynamic contact surface and lay a good foundation for subsequent position adjustments, after determining the deflection angle, the angle of the virtual character relative to the dynamic contact surface can be adjusted according to the deflection angle. That is, the angle of the virtual character's target bone relative to the dynamic contact surface is adjusted according to the deflection angle, thereby ensuring that the virtual character is perpendicular to the dynamic contact surface in each subsequent frame.
[0096] For example, if a game character stands on the seventh section of a bamboo, the character's weight will bend the seventh section. To ensure a reasonable posture, you can select the seventh section's parent bone, that is, the sixth section of the bamboo, as the parent bone. Then, adjust the character's foot bones according to the angle between the seventh and sixth sections, so that the character's foot can fit the curved surface of the bamboo at the contact point, making the picture more reasonable and realistic.
[0097] Step S106: establishing a positional relationship between the virtual character and the dynamic contact surface based on the mapped position.
[0098] Specifically, after determining the mapping position of the virtual character relative to the dynamic contact surface as described above, further, in order to be able to maintain the relative positional relationship between the dynamic contact surface and the virtual character in each subsequent frame, so as to show the effect that the virtual character moves with the movement of the dynamic contact surface, the positional relationship between the virtual character and the appropriate contact points on the dynamic contact surface in the current frame can be established based on the mapping position, so as to facilitate the subsequent adjustment of the relative positional relationship in each frame according to this positional relationship, ensuring that the two are more closely aligned and support the effect of follow-up. Among them, the positional relationship specifically refers to the relative positional relationship between the dynamic contact surface and the virtual character, that is, the relative straight-line distance between the two.
[0099] Furthermore, when determining the positional relationship between the virtual character and the dynamic contact surface, it is considered that the mapping position is determined based on the target skeleton of the virtual character, and the target skeleton does not have coordinate information in the world coordinate system, only the position information of the virtual character exists. Therefore, it is necessary to determine the positional relationship between the mapping position and the appropriate contact point on the dynamic contact surface in the same coordinate system in order to determine the positional relationship between the virtual character and the dynamic contact surface. In this embodiment, the specific implementation method is as follows:
[0100] Determining a contact position corresponding to the virtual character on the dynamic contact surface, and determining a coordinate system corresponding to the contact position;
[0101] Determining mapping coordinate information corresponding to the mapping position and contact coordinate information corresponding to the contact position in the coordinate system;
[0102] Calculating an offset between the contact position and the mapped position according to the mapped coordinate information and the contact coordinate information;
[0103] The positional relationship between the virtual character and the dynamic contact surface is determined based on the offset.
[0104] Specifically, the contact position refers to the contact point selected on the dynamic contact surface. The contact position can be determined based on the distance between the target bone and the dynamic contact surface. The contact position is used to support the movement of the virtual character relative to the dynamic contact surface. In other words, the contact position will establish a binding relationship with the virtual character, so that no matter how the dynamic contact surface moves, the virtual character can be bound relative to the contact position, so that the same positional relationship with the dynamic contact surface can be maintained in each frame. Correspondingly, the mapping coordinate information specifically refers to the coordinate information of the mapping position in the world coordinate system; correspondingly, the contact coordinate information specifically refers to the coordinate information of the contact position in the world coordinate system; the offset is the relative distance between the mapping position and the contact position in the coordinate system.
[0105] Based on this, in order to accurately determine the position relationship of the virtual character relative to the dynamic contact surface in the current frame, it is ensured that the position of the virtual character can be updated based on this position relationship in each subsequent frame to show the effect that the virtual character moves with the movement of the dynamic contact surface. A suitable point can be determined on the dynamic contact surface as the contact position corresponding to the virtual character, and the coordinate system corresponding to the contact position can be determined. Then, the mapping coordinate information corresponding to the mapping position and the contact coordinate information corresponding to the contact position are located in the coordinate system. Based on the mapping coordinate information and the contact coordinate information, the offset between the contact position and the mapping position, that is, the relative position offset of the mapping position, can be calculated. Finally, the position relationship between the virtual character and the dynamic contact surface can be established according to the offset, so that the contact position of the virtual character and the dynamic contact surface can be controlled in each subsequent frame to offset the position, so that the virtual character can move with the dynamic contact surface.
[0106] In practical applications, when calculating the offset, considering the calculation accuracy, it can be completed using the collision detection body corresponding to the virtual character. That is, the coordinate information of the bottom of the collision detection body in the local coordinate system is determined, and the offset can be calculated based on the coordinate information and the mapped coordinate information.
[0107] Continuing with the above example, select a contact point on the lake surface and determine the local coordinate system corresponding to the contact point. In the local coordinate system, determine the coordinates of the target position of the foot IK as (x1, y1, z1), and the coordinates of the contact point as (x2, y2, z2). Then, use the coordinates of the contact point as the reference point, combine the coordinates of the target position of the foot IK (x1, y1, z1) and the coordinates of the contact point (x2, y2, z2), and calculate the offset as (x3, y3, z3). That is, the new position of the target position of the foot IK based on the local coordinate system of the contact point is (x3, y3, z3); this makes it convenient to update the position of the game character based on the coordinates of the contact point and the offset (x3, y3, z3) in each subsequent frame, so that the game character can be bound to the contact point, and the game character can move with the fluctuations of the lake.
[0108] In summary, by locating the coordinate information of the mapping position and the coordinate information of the contact position in the local coordinate system, the contact position and the mapping position can be reflected in the same coordinate system, so that the offset between the two can be accurately calculated, and the position relationship between the virtual character and the dynamic contact surface in the current frame can be determined based on the offset, so that the position can be adjusted based on this position relationship in each frame later.
[0109] Step S108 : When the dynamic contact surface moves relative to the virtual character, the position of the virtual character is updated according to the positional relationship.
[0110] Specifically, after the positional relationship between the virtual character and the dynamic contact surface is established as described above, further, in order to ensure that the virtual character and the dynamic contact surface are more closely aligned and that the two can move with each other, the position of the virtual character can be updated according to the positional relationship when the dynamic contact surface moves relative to the virtual character. That is, in each subsequent frame, if the contact position in the dynamic contact surface moves, the position of the virtual character will be adjusted according to the positional relationship in each frame, so that the virtual character can maintain a constant relative distance with respect to the contact position in the dynamic contact surface, thereby demonstrating the effect of the two moving with each other. That is, the movement of the dynamic contact surface causes the contact position to change, and since the contact position is bound to the virtual character, the position update is completed in each frame in combination with the offset.
[0111] Furthermore, when the position of the virtual character is updated according to the position relationship, since the distance between the dynamic contact surface and the virtual character changes in each frame, it is necessary to adjust it according to the position relationship. In this embodiment, the specific implementation method is as follows:
[0112] Determine the initial position of the target bone in the world coordinate system in the current animation frame;
[0113] The initial position is adjusted based on the positional relationship, and the position of the virtual character in the current animation frame is updated according to the adjustment result.
[0114] Specifically, the initial position refers to the position of the target bone in the world coordinate system in the current animation frame, and at this time, based on the initial position, the distance between the virtual character and the dynamic contact surface in motion in the current animation frame can be determined. In order to ensure that the virtual character and the dynamic contact surface can move with each other and that the distance is not too large or too small, the initial position can be adjusted according to the position relationship.
[0115] Based on this, first determine the initial position of the target bone in the world coordinate system in the current animation frame, then adjust the initial position based on the position relationship, and finally update the position of the virtual character in the current animation frame according to the adjustment result, so that the virtual character always maintains a constant relative distance from the dynamic contact surface and will not change due to the movement of the dynamic contact surface. At this time, the virtual character can follow the dynamic contact surface.
[0116] In summary, by adjusting the position of the virtual character relative to the contact position in the dynamic contact surface according to the position relationship in each frame, it can be ensured that the distance between the virtual character and the contact position in the dynamic contact surface is constant, thereby achieving a follow-up display effect of the two.
[0117] In addition, in order to save computing resources and ensure that the virtual character moves with the dynamic contact surface, the position can be adjusted according to the position relationship in each frame of the motion cycle to generate the target animation. In this embodiment, the specific implementation method is as follows:
[0118] Determining a motion cycle of the dynamic contact surface, and splicing animation frames within the motion cycle in chronological order;
[0119] A target animation including the virtual character and the dynamic contact surface is generated and displayed according to the splicing result.
[0120] Specifically, the motion cycle refers to the period during which the dynamic contact surface undergoes motion changes; correspondingly, the target animation refers to the animation after adjusting the position of the virtual character relative to the dynamic contact surface in each frame, and in this animation, the virtual character moves relative to the dynamic contact surface.
[0121] Based on this, we first determine the motion cycle of the dynamic contact surface, and then splice the animation frames that have completed position adjustment according to the motion cycle. According to the splicing results, we can create a target animation containing a virtual character and a dynamic contact surface and display it.
[0122] Using the above example, see Figure 2 In the diagram shown in (a), the distance between the game character and the lake surface in the first frame is S1. Then, in the foot IK adjustment of each frame, the world coordinate information of the foot bone is obtained and the offset (x3, y3, z3) in the first frame is superimposed to obtain the foot IK target position in each subsequent frame. When the lake surface fluctuates, the game character adjusts its position according to (x3, y3, z3) in each frame, so that the game character moves relative to the movement of the lake surface, showing the following. Figure 2 (b) and Figure 2 The effect of (c) Figure 2 (b) and Figure 2 (c) in the middle represents any two frames in the target animation.
[0123] The position updating method provided by the present application, in order to enable the virtual character to move along with the movement of the dynamic contact surface, after obtaining the bone position corresponding to the target bone of the virtual character, the mapping position of the target bone mapping on the dynamic contact surface can be determined according to the bone position, and then the positional relationship between the virtual character and the dynamic contact surface is established based on the mapping position. When the dynamic contact surface moves relative to the virtual character, the position of the virtual character can be updated according to the position of the contact point on the dynamic contact surface according to the positional relationship, so that when the dynamic contact surface moves, the virtual character in contact with the dynamic contact surface can move together, and the fit between the virtual character and the dynamic contact surface can be guaranteed through the positional relationship, thereby presenting a more realistic virtual scene to the user.
[0124] The following combined Figure 3 , taking the application of the location update method provided by this application in a game scenario as an example, the location update method is further explained. Figure 3 A processing flow chart of a location update method in an application game scenario provided by an embodiment of the present application is shown, which specifically includes the following steps:
[0125] Step S302: Select a target character bone that is closest to the dynamic contact surface from the character bones corresponding to the virtual character as the target bone.
[0126] Step S304: determine the world coordinate system to which the virtual character belongs, and determine the bone position corresponding to the target bone based on the world coordinate system.
[0127] Step S306: creating an auxiliary line between the bone position and the dynamic contact surface.
[0128] Step S308 : determining the contact point based on the intersection of the dynamic contact surface and the auxiliary line, and using the position of the contact point as the mapping position.
[0129] Step S310 , determining the contact position corresponding to the virtual character on the dynamic contact surface, determining a coordinate system corresponding to the contact position, and determining mapping coordinate information corresponding to the mapping position and contact coordinate information corresponding to the contact position in the coordinate system.
[0130] Step S312: Calculate the offset between the contact position and the mapped position according to the mapped coordinate information and the contact coordinate information.
[0131] Step S314: determining the positional relationship between the virtual character and the dynamic contact surface based on the offset.
[0132] Step S316 , when the dynamic contact surface moves relative to the virtual character, determining the initial position of the target bone in the world coordinate system in the current animation frame.
[0133] Step S318: adjusting the initial position based on the positional relationship, and updating the position of the virtual character in the current animation frame according to the adjustment result.
[0134] Furthermore, to achieve a reasonable target skeletal pose for the avatar, an appropriate offset angle is selected based on the contact surface. For example, the deflection angle between the avatar and the dynamic contact surface is adjusted based on the deflection angle, while the deflection angle can be determined based on the normal direction of the dynamic contact surface.
[0135] Step S320: determining the motion cycle of the dynamic contact surface, and splicing the animation frames within the motion cycle in chronological order.
[0136] Step S322: Generate and display a target animation including the virtual character and the dynamic contact surface based on the splicing result.
[0137] To sum up, in order to enable the virtual character to move along with the movement of the dynamic contact surface, after obtaining the bone position corresponding to the target bone of the virtual character, the mapping position of the target bone mapping on the dynamic contact surface can be determined according to the bone position, and then the positional relationship between the virtual character and the dynamic contact surface is established based on the mapping position. When the dynamic contact surface moves relative to the virtual character, the position of the virtual character can be updated according to the position of the contact point on the dynamic contact surface according to the positional relationship, so that when the dynamic contact surface moves, the virtual character in contact with the dynamic contact surface can move together, and the fit between the virtual character and the dynamic contact surface can be guaranteed through the positional relationship, thereby showing a more realistic virtual scene to the user.
[0138] Corresponding to the above method embodiment, the present application also provides a location updating device embodiment, Figure 4 FIG. 1 shows a schematic diagram of the structure of a location updating device provided by an embodiment of the present application. Figure 4 As shown, the device includes:
[0139] An acquisition module 402 is configured to acquire a bone position corresponding to a target bone of the virtual character;
[0140] A determination module 404 is configured to determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position;
[0141] An establishing module 406 is configured to establish a positional relationship between the virtual character and the dynamic contact surface based on the mapped position;
[0142] The updating module 408 is configured to update the position of the virtual character according to the positional relationship when the dynamic contact surface moves relative to the virtual character.
[0143] In an optional embodiment, the acquisition module 402 is further configured to:
[0144] A target character bone that is closest to the dynamic contact surface is selected from the character bones corresponding to the virtual character as the target bone; a world coordinate system to which the virtual character belongs is determined, and a bone position corresponding to the target bone is determined based on the world coordinate system.
[0145] In an optional embodiment, the location updating device further includes:
[0146] The rotation module is configured to rotate the virtual character according to an inclination angle when there is an inclination angle between the virtual character and the dynamic contact surface; wherein the rotated virtual character is perpendicular to the dynamic contact surface.
[0147] In an optional embodiment, the determining module 404 is further configured to:
[0148] An auxiliary line is created between the skeleton position and the dynamic contact surface; a contact point is determined based on an intersection of the dynamic contact surface and the auxiliary line, and the position of the contact point is used as the mapping position.
[0149] In an optional embodiment, the establishing module 406 is further configured to:
[0150] Determine the contact position corresponding to the virtual character on the dynamic contact surface, and determine the coordinate system corresponding to the contact position; determine the mapping coordinate information corresponding to the mapping position and the contact coordinate information corresponding to the contact position in the coordinate system; calculate the offset between the contact position and the mapping position based on the mapping coordinate information and the contact coordinate information; and determine the positional relationship between the virtual character and the dynamic contact surface based on the offset.
[0151] In an optional embodiment, the updating module 408 is further configured to:
[0152] Determine the initial position of the target bone in the world coordinate system in the current animation frame; adjust the initial position based on the positional relationship, and update the position of the virtual character in the current animation frame according to the adjustment result.
[0153] In an optional embodiment, the location updating device further includes:
[0154] The display module is configured to determine the motion cycle of the dynamic contact surface and splice the animation frames within the motion cycle in chronological order; generate and display a target animation including the virtual character and the dynamic contact surface based on the splicing result.
[0155] In an optional embodiment, the location updating device further includes:
[0156] The adjustment module is configured to determine a deflection angle between the virtual character and the dynamic contact surface; and adjust an angular relationship between the virtual character and the dynamic contact surface according to the deflection angle.
[0157] In an optional embodiment, the adjustment module is further configured to:
[0158] Determine the parent bone corresponding to the contact position in the dynamic contact surface; determine the target deflection angle between the parent bone and the contact bone to which the contact position belongs, as the deflection angle between the virtual character and the dynamic contact surface.
[0159] The position updating device provided by the present application, in order to enable the virtual character to move along with the movement of the dynamic contact surface, after obtaining the bone position corresponding to the target bone of the virtual character, the mapping position of the target bone mapping on the dynamic contact surface can be determined according to the bone position, and then the positional relationship between the virtual character and the dynamic contact surface is established based on the mapping position. When the dynamic contact surface moves relative to the virtual character, the position of the virtual character can be updated according to the position of the contact point on the dynamic contact surface according to the positional relationship, so that when the dynamic contact surface moves, the virtual character in contact with the dynamic contact surface can move together, and the fit between the virtual character and the dynamic contact surface can be guaranteed through the positional relationship, thereby presenting a more realistic virtual scene to the user.
[0160] The above is a schematic scheme of a location update device of this embodiment. It should be noted that the technical solution of the location update device and the technical solution of the location update method mentioned above belong to the same concept. For details not described in detail in the technical solution of the location update device, please refer to the description of the technical solution of the location update method mentioned above. 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. 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.
[0161] Figure 5The block diagram shows a structure of a computing device 500 according to an embodiment of the present application. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.
[0162] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. 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 540 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.
[0163] In one embodiment of the present application, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 5 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.
[0164] Computing device 500 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a 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 PC. Computing device 500 can also be a mobile or stationary server.
[0165] The processor 520 is configured to execute the following computer-executable instructions:
[0166] Get the bone position corresponding to the target bone of the virtual character;
[0167] Determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position;
[0168] establishing a positional relationship between the virtual character and the dynamic contact surface based on the mapped position;
[0169] When the dynamic contact surface moves relative to the virtual character, the position of the virtual character is updated according to the positional relationship.
[0170] The above is a schematic solution of a computing device of this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the above-mentioned location update method are of 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 above-mentioned location update method.
[0171] An embodiment of the present application further provides a computer-readable storage medium storing computer instructions, which, when executed by a processor, are used to:
[0172] Get the bone position corresponding to the target bone of the virtual character;
[0173] Determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position;
[0174] establishing a positional relationship between the virtual character and the dynamic contact surface based on the mapped position;
[0175] When the dynamic contact surface moves relative to the virtual character, the position of the virtual character is updated according to the positional relationship.
[0176] The above is a schematic solution of a computer-readable storage medium of this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the above-mentioned location update method are of 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 above-mentioned location update method.
[0177] An embodiment of the present application further provides a chip storing a computer program, which implements the steps of the location updating method when executed by the chip.
[0178] The foregoing description describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0179] 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.
[0180] 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.
[0181] 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 description of other embodiments.
[0182] 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 location updating method, characterized in that: include: Get the bone position corresponding to the target bone of the virtual character; Determining a mapping position of the target bone mapping on the dynamic contact surface according to the bone position; Establishing a positional relationship between the virtual character and a suitable contact point on the dynamic contact surface in a current frame based on the mapped position; When the dynamic contact surface moves relative to the virtual character, the position of the virtual character is updated according to the positional relationship, wherein when the dynamic contact surface moves relative to the virtual character, updating the position of the virtual character according to the positional relationship includes: if the contact position on the dynamic contact surface moves in each subsequent frame, adjusting the position of the virtual character according to the positional relationship in each subsequent frame so that the virtual character has a constant relative distance with respect to the contact position in the dynamic contact surface.
2. The location updating method according to claim 1, wherein: The step of obtaining the bone position corresponding to the target bone of the virtual character includes: Selecting a target character bone that is closest to the dynamic contact surface from the character bones corresponding to the virtual character as the target bone; Determine a world coordinate system to which the virtual character belongs, and determine a bone position corresponding to the target bone based on the world coordinate system.
3. The location updating method according to claim 1, wherein: Before the step of obtaining the bone position corresponding to the target bone of the virtual character is performed, the method further includes: In a case where there is an inclination angle between the virtual character and the dynamic contact surface, rotating the virtual character according to the inclination angle; The rotated virtual character is perpendicular to the dynamic contact surface.
4. The location updating method according to claim 1, wherein: Determining the mapping position of the target bone mapping on the dynamic contact surface according to the bone position includes: creating a guide line between the bone position and the dynamic contact surface; A contact point is determined based on an intersection of the dynamic contact surface and the auxiliary line, and a position of the contact point is used as the mapped position.
5. The location updating method according to claim 1, wherein: The establishing of a positional relationship between the virtual character and the dynamic contact surface based on the mapped position includes: Determining a contact position corresponding to the virtual character on the dynamic contact surface, and determining a coordinate system corresponding to the contact position; Determining mapping coordinate information corresponding to the mapping position and contact coordinate information corresponding to the contact position in the coordinate system; Calculating an offset between the contact position and the mapped position according to the mapped coordinate information and the contact coordinate information; The positional relationship between the virtual character and the dynamic contact surface is determined based on the offset.
6. The location updating method according to claim 1, wherein: The updating of the position of the virtual character according to the position relationship includes: Determine the initial position of the target bone in the world coordinate system in the current animation frame; The initial position is adjusted based on the positional relationship, and the position of the virtual character in the current animation frame is updated according to the adjustment result.
7. The location updating method according to claim 6, wherein: After the step of updating the position of the virtual character according to the position relationship is performed, the method further includes: Determining a motion cycle of the dynamic contact surface, and splicing animation frames within the motion cycle in chronological order; A target animation including the virtual character and the dynamic contact surface is generated and displayed according to the splicing result.
8. The location updating method according to claim 5, wherein: After the step of obtaining the bone position corresponding to the target bone of the virtual character is executed, the method further includes: determining a deflection angle between the virtual character and the dynamic contact surface; The angular relationship between the virtual character and the dynamic contact surface is adjusted according to the deflection angle.
9. The location updating method according to claim 8, wherein: Determining the deflection angle between the virtual character and the dynamic contact surface includes: Determining a parent bone corresponding to the contact position in the dynamic contact surface; A target deflection angle between the parent bone and the contact bone to which the contact position belongs is determined as a deflection angle between the virtual character and the dynamic contact surface.
10. A location updating device, characterized in that: include: An acquisition module is configured to acquire a bone position corresponding to a target bone of the virtual character; a determination module configured to determine a mapping position of the target bone mapping on the dynamic contact surface according to the bone position; an establishing module configured to establish a positional relationship between the virtual character and a suitable contact point on the dynamic contact surface in a current frame based on the mapped position; The update module is configured to update the position of the virtual character according to the positional relationship when the dynamic contact surface moves relative to the virtual character. The update module is further configured to adjust the position of the virtual character according to the positional relationship in each subsequent frame if the contact position on the dynamic contact surface moves in the frame, so that the virtual character has a constant relative distance with respect to the contact position in the dynamic contact surface.
11. 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 method according to any one of claims 1 to 9.
12. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Attitude determination method and device of virtual object in three-dimensional virtual environment and medium
CN108245893A