CN112354186B - Game animation model control method, device, electronic equipment and storage medium - Google Patents
Game animation model control method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN112354186B CN112354186B CN202011247097.8A CN202011247097A CN112354186B CN 112354186 B CN112354186 B CN 112354186B CN 202011247097 A CN202011247097 A CN 202011247097A CN 112354186 B CN112354186 B CN 112354186B
- Authority
- CN
- China
- Prior art keywords
- animation
- action
- game
- model
- skeleton
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 53
- 230000009471 action Effects 0.000 claims abstract description 225
- 239000011159 matrix material Substances 0.000 claims description 100
- 230000009466 transformation Effects 0.000 claims description 95
- 230000033001 locomotion Effects 0.000 claims description 52
- 210000000988 bone and bone Anatomy 0.000 claims description 47
- 230000004927 fusion Effects 0.000 claims description 27
- 238000012545 processing Methods 0.000 claims description 7
- 230000004044 response Effects 0.000 claims description 4
- 230000009191 jumping Effects 0.000 abstract description 4
- 230000001276 controlling effect Effects 0.000 description 31
- 230000000875 corresponding effect Effects 0.000 description 11
- 238000006073 displacement reaction Methods 0.000 description 10
- 230000007704 transition Effects 0.000 description 10
- 238000004519 manufacturing process Methods 0.000 description 8
- 230000008569 process Effects 0.000 description 8
- 230000000694 effects Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 238000004364 calculation method Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 230000001960 triggered effect Effects 0.000 description 3
- 230000004048 modification Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 238000013519 translation Methods 0.000 description 2
- 230000006978 adaptation Effects 0.000 description 1
- 238000006243 chemical reaction Methods 0.000 description 1
- 230000000052 comparative effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/55—Controlling game characters or game objects based on the game progress
- A63F13/56—Computing the motion of game characters with respect to other game characters, game objects or elements of the game scene, e.g. for simulating the behaviour of a group of virtual soldiers or for path finding
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F2300/00—Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
- A63F2300/60—Methods for processing data by generating or executing the game program
- A63F2300/66—Methods for processing data by generating or executing the game program for rendering three dimensional images
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Human Computer Interaction (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application provides a game animation model control method, a device, electronic equipment and a storage medium, which comprise the steps of determining a first action parameter of a game animation model according to an animation key frame, controlling the game animation model to execute the first action in a game scene space according to the first action parameter, triggering a second action parameter of the game animation model according to skeleton animation data to determine the second action parameter when the current animation key frame is a target key frame, controlling the game animation model to execute the second action according to the second action parameter, triggering a third action parameter of the game animation model according to the animation key frame to execute the third action according to the third action parameter, and avoiding jumping of the action of the animation model caused by controlling the game animation model simultaneously by the skeleton animation data and the animation key frame without inserting complex animation key frames at action joints.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and apparatus for controlling a game animation model, an electronic device, and a storage medium.
Background
In the process of producing the instant calculation animation of the 3D game, existing art resources (such as models, special effects and the like) in the game are often used, a series of displacement, rotation or action and the like are set for each role, so that a key frame is produced, and the animation effect is realized by continuously playing the key frame.
When the turning representation of the character in the cut scene is produced, the skeleton animation resource of the turning action is added into the key frame, so that the representation is more natural. Typically, key frames and skeletal animations are combined as follows: firstly playing a key frame, inserting turning skeleton animation data after playing a section of key frame, and jointly realizing turning expression by combining the skeleton animation data with the key frame. After the turning action is completed, the idle action needs to be linked, that is, the skeleton animation data of the turning action, the skeleton animation data of the idle action and the key frame need to be fused. In order to achieve the natural connection between the turning motion and the idle motion, it is generally necessary to add a key frame to the overlapping portion of the skeletal animation data of the turning motion and the skeletal animation data of the idle motion, so as to ensure that the character does not jump at the rotation angle from the turning motion to the idle motion.
However, the inventors found that increasing the number of key frames increases with the complexity of the turning motion, resulting in a long time-consuming production of turning animation data, and a significant increase in the data volume.
Disclosure of Invention
The application provides a game animation model control method, a game animation model control device, electronic equipment and a storage medium, which aim to reduce the difficulty of animation data production and improve the animation display effect.
In a first aspect, the present application provides a game animation model control method, including:
Determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter;
When the current animation key frame is a target key frame, triggering a second action parameter of the game animation model according to the skeleton animation data, and controlling the game animation model to execute a second action after the first action according to the second action parameter;
And triggering a third action parameter of the game animation model according to the animation key frame to be determined in response to the end of the second action, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
Optionally, the second action is a turn-around action, the skeletal animation data comprises a root skeletal transformation matrix and a transformation matrix of the game animation model,
Determining a second action parameter of the game animation model according to the bone animation data, wherein the second action parameter specifically comprises:
determining the rotation angles of the game animation model in an x coordinate axis and a z coordinate axis according to the root skeleton transformation matrix;
determining the rotation angle of the game animation model in the y coordinate axis according to the transformation matrix of the game animation model;
Wherein the y coordinate axis is a coordinate axis referred to when the game animation model completes the turning motion.
Optionally, before triggering the determination of the second action parameters of the game animation model according to the preset skeletal animation data, the method further comprises:
determining multi-frame bone animation data according to the starting position and the ending position of the second action;
Processing the root skeleton transformation matrix according to the root skeleton transformation matrix to obtain an updated model transformation matrix;
Setting the rotation angle on the y coordinate axis in the root skeleton transformation matrix to be zero to obtain an updated root skeleton transformation matrix;
wherein each frame of skeletal animation data comprises a root skeletal transformation matrix and a model transformation matrix.
Optionally, processing the root skeleton transformation matrix to obtain an updated model transformation matrix according to the root skeleton transformation matrix specifically includes:
obtaining an angle difference value according to the first angle and the second angle;
Obtaining an updated model transformation matrix according to the angle difference value and the model transformation matrix;
The first angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the ith frame of skeleton animation data, the second angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the (i+1) th frame of skeleton animation data, i is more than or equal to 0 and less than or equal to n, and n is used for identifying the total frame number of the skeleton animation data.
Optionally, before determining the first action parameter of the game animation model according to the animation key frame, the method further comprises:
determining an animation key frame at the fusion starting moment according to the initial frame of the skeleton animation data;
The fusion starting time is the initial frame corresponding time of the skeleton animation data.
Optionally, before triggering the determination of the third action parameter of the game animation model from the animation key frame, the method further comprises:
Determining animation key frames at the fusion end time according to the end frames of the skeleton animation data;
The fusion end time is the corresponding time of the end frame of the skeleton animation data.
Optionally, determining the multi-frame skeletal animation data according to the starting position and the ending position of the second action specifically includes:
and determining multi-frame bone animation data according to the starting position and the ending position of the second action by using interpolation method.
In a second aspect, the present application provides a game animation model control device comprising:
The control module is used for determining a first action parameter of the game animation model according to the animation key frame and controlling the game animation model to execute a first action in the game scene space according to the first action parameter;
The control module is also used for triggering to determine a second action parameter of the game animation model according to the skeleton animation data when the current animation key frame is a target key frame, and controlling the game animation model to execute a second action after the first action according to the second action parameter;
the control module is also used for responding to the end of the second action, triggering and determining a third action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
In a third aspect, the present application provides an electronic device comprising:
a memory for storing a program;
A processor for executing a program stored in the memory, the processor being configured to execute the game animation model control method according to the first aspect and the optional aspects when the program is executed.
In a fourth aspect, the present application provides a computer-readable storage medium having stored therein computer-executable instructions;
Computer-executable instructions, when executed by a processor, are for implementing the game animation model control method according to the first aspect and the optional aspects.
The embodiment of the application provides a game animation model control method, a game animation model control device, electronic equipment and a storage medium, wherein the motion of a game animation model is controlled by an animation key frame, when a current animation key frame is a target key frame, a second motion parameter of the game animation model is triggered and determined according to skeleton animation data, the game animation model is controlled to execute the second motion after the first motion according to the second motion parameter, the motion of the game animation model is controlled by the animation key frame in response to the end of the second motion, jump of the animation model at the joint of the two motions caused by simultaneous control of the skeleton animation data and the key frame is avoided, the complex key frame is not required to be inserted into the joint of the two motions of the game animation model, namely, the key frame is not required to be inserted into the transition between the skeleton animation data and the animation key frame, and the manufacturing difficulty of the animation data is reduced.
Drawings
FIG. 1 is a schematic diagram of an animation data playback scheme according to the prior art;
FIG. 2 is a flow chart of a method for controlling a game animation model according to an embodiment of the application;
FIG. 3 is a flowchart illustrating a method for controlling a game animation model according to another embodiment of the present application;
FIG. 4 is a schematic diagram illustrating a data playing of a game animation model control method according to another embodiment of the present application;
FIG. 5 is a schematic diagram of a game animation model control device according to another embodiment of the present application;
Fig. 6 is a schematic structural diagram of an electronic device according to another embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to the accompanying drawings, and it is apparent that the described embodiments are some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the process of producing the instant calculation animation of the 3D game, existing art resources (such as models, special effects and the like) in the game are often used, a series of displacement, rotation or action and the like are set for each role to produce a key frame, and the animation effect is realized by continuously playing the key frame.
When the turning representation of the character in the cut scene is produced, the skeleton animation resource of the turning action is added into the key frame, so that the representation is more natural. Typically, key frames and skeletal animations are combined as follows: firstly playing a key frame, inserting skeleton animation data of a turning action after playing a section of key frame, and realizing turning expression by combining the skeleton animation data with the key frame during the continuous playing time of the skeleton animation data of the turning action. After the turning action is completed, an idle action is also needed to be connected, namely, the skeleton animation data of the turning action, the skeleton animation data of the idle action and the key frame are needed to be fused at the place where the idle action and the turning action are transited. In order to achieve the natural connection between the turning motion and the idle motion, it is generally necessary to add a key frame to the overlapping portion of the skeletal animation data of the turning motion and the skeletal animation data of the idle motion, so as to ensure that the character does not jump at the rotation angle from the turning motion to the idle motion.
The prior art is described below with reference to fig. 1, wherein animation data production is achieved by a key frame in combination with a skeletal animation. Wherein f1 is a starting key frame, after playing a certain number of key frames, the skeletal animation data of the turning action and the skeletal animation data of the idle action are sequentially added, and a transition is formed between the skeletal animation data of the turning action and the skeletal animation data of the idle action.
The inventors found that: in order to realize the fusion of the key frame and the skeleton animation data, the key frame f2 is inserted before the skeleton animation data of the turning action is played, so that the y-axis of the character is oriented to 0 degree before the turning action is played. The turning motion lasts for 1.47 seconds, the idle motion is connected subsequently, and the black motion bar represents a transition section generated by overlapping adjacent motion frames.
At the beginning of the transition to the idle action, i.e. the black action bar start moment, the character appears to stop turning gradually, and the modification of the angular orientation of the turning action also ends at this moment, assuming that this angle is-140 degrees. Therefore, it is necessary to insert the key frame f4 at the end time of the turning operation to set the direction of the end operation to-140 degrees. During the black progress bar, the character model is affected by the keyframes, resulting in a 180 degree right turn representation. Therefore, it is necessary to insert the key frame f3 at the start time of the action fusion, and set f3 to 40 degrees.
By interpolating between the key frames f3 to f4, the orientation of the overall character appearance during the transition is controlled to remain substantially unchanged at-140 degrees. When the bone steering angular velocity of the turning action is non-uniform, the interpolation curve between the key frames f3 and f4 also needs to be changed from linearity to a more complex higher-order curve, or more key frame adaptation angular velocity curves are inserted between the key frames f3 and f 4.
However, the inventors found that increasing the number of key frames increases with the complexity of the turning motion, resulting in a long time-consuming production of turning animation data, and a significant increase in the data volume. Especially in cutscene, the turn-around performance may be frequently applied. In order to support the turning action with rich visual effect, complex key frames need to be added frequently at a plurality of time points, so that the animation production efficiency is obviously reduced.
The application provides a game animation model control method, a game animation model control device, electronic equipment and a storage medium, and aims to solve the problems. The application is characterized in that: and shielding the animation key frame control in the process of playing the skeleton animation data. That is, the skeletal animation data takes over the character orientation information, the animation model is separated from the control of the key frame at the beginning frame of the skeletal animation data, and the animation model is controlled by the key frame at the end frame of the skeletal animation data. And the rotation information of the action ending frame is inserted into the key frame sequence in real time, and the control of the key frame is smoothly transited, so that the situation that the skeleton animation data and the key frame control the animation model simultaneously to cause the animation model to jump at the joint of two actions is avoided, the animation key frame and the skeleton animation data are well fused, and the complex key frame is not required to be inserted into the joint of the two actions of the game animation model.
As shown in fig. 2, the method for controlling a game animation model provided by the embodiment of the application is applied to electronic equipment, wherein the electronic equipment is computer equipment, intelligent terminals and other equipment, and the method comprises the following steps:
S101, determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter.
Wherein, the animation key frame refers to the key frame of the game animation model determined according to the game animation production requirement. The animation key frame is obtained by setting a series of actions such as displacement or rotation for each game animation model. That is, the animation key frame contains the action parameters of the game animation model, such as: model translation parameters or model rotation parameters. The action parameters of the game animation model are used for controlling the game animation model to complete corresponding actions in the game scene space.
The game animation model is controlled by the animation key frame to complete the first action. That is, a first action parameter of the game animation model is determined according to the animation key frame, and the game animation model is controlled to execute a first action in the game scene space according to the first action parameter.
And S102, when the current animation key frame is the target key frame, triggering to determine second action parameters of the game animation model according to skeleton animation data of the game animation model, and controlling the game animation model to execute second actions after the first actions according to the second action parameters.
The corresponding time of the target key frame is the trigger time of the game animation model controlled by the skeleton animation data, and the target key frame is determined according to the actual animation production requirement.
When the current animation key frame is the target key frame, the animation key frame controls the game animation model to complete corresponding actions and is switched to the skeletal animation data controls the game animation model to complete corresponding actions. That is, after the first action is completed by the game animation model controlled by the animation key frame, the game animation model is switched to the second action is completed by the game animation model controlled by the skeletal animation data.
The skeletal animation data comprises skeletal coordinate transfer data of a game animation model. When a switch to controlling the game animation model by the skeletal animation data is required, determining a second action parameter of the game animation model according to the skeletal animation data of the game animation model. That is, the coordinate transfer data of the parent skeleton and the coordinate transfer data of the child skeleton in the game animation model are determined. And controlling the game animation model to complete the second action according to the second action parameter of the game animation model.
And S103, responding to the end of the second action, triggering a third action parameter for determining the game animation model according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
Wherein, after the control of the game animation model is finished by the skeleton animation data, the game animation model is controlled by the animation key frame. That is, after the game animation model completes the second action, the animation key frame controls the game animation model to complete the third action.
More specifically, a third action parameter of the game animation model is determined from the animation key frames. The third operating parameter is also a model translation parameter or a model rotation parameter. And controlling the game animation model to complete the third action according to the third action parameters.
In the game animation model control method provided by the embodiment of the application, when the playing skeleton game data is inserted into the animation key frame, the action parameters of the game animation model are independently controlled by the skeleton animation data, the influence of the animation key frame on the game animation model is shielded, and the phenomenon that the animation model jumps at the joint of two actions caused by simultaneous control of the skeleton animation data and the key frame by the animation model is avoided.
As shown in fig. 3, the embodiment of the present application describes a game animation model control method in combination with a process of merging a turning motion and an idle motion, the game animation model control method comprising the steps of:
S201, determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter.
Wherein, this step is already described in detail in the above embodiments, and will not be described here again.
S202, determining an animation key frame at the fusion starting moment according to the initial frame of the skeleton animation data.
The fusion starting time is the initial frame corresponding time of the skeleton animation data. In order to better fuse the animation key frames with the bone animation data, the animation key frames at the fusion starting time are determined according to the initial frames of the bone animation data, so that the first action parameters generated according to the animation key frames at the fusion starting time are the same as the second action parameters generated according to the initial frames of the bone animation data, and the action of the game animation model is prevented from jumping.
And S203, when the current animation key frame is the target key frame, triggering to determine second action parameters of the game animation model according to the skeleton animation data of the game animation model, and controlling the game animation model to execute the second action after the first action according to the second action parameters.
The step is already described in detail in S102, and the repetition is not described in detail.
The process of determining the second action parameters of the game animation model from the skeletal animation data of the game animation model is described in detail below.
The skeletal animation data includes a root skeletal transformation matrix and a transformation matrix of the game animation model, the transformation matrix of the game animation model being used to control centroid movement of the game animation model. The model transformation matrix is used for changing the displacement and the gesture of the animation model in the space. The root skeleton transformation matrix is used for controlling the movement of each node in the root skeleton in the game animation model, and the root skeleton transformation matrix is used for changing the relative displacement and the relative gesture between each node of the root skeleton in the model.
The model transformation matrix includes a displacement transformation matrix of a centroid of the animation model and an angle transformation matrix of the centroid of the animation model. The root bone transformation matrix includes a displacement transformation matrix of the root bone and an angle transformation matrix of the root bone.
In the displacement transformation matrix of the centroid and the displacement transformation matrix of the bone, each displacement component represents the position change quantity of the current frame relative to the initial animation frame. Similarly, in the above-described centroid angle transformation matrix and bone-following angle transformation matrix, each angle component represents the amount of angle change of the current frame relative to the initial animation frame.
The process of obtaining skeletal animation data is described below: the start position of the second action refers to the start position of the game animation model when the second action is performed. The end position of the second action refers to the end position of the game animation model at the time of completion of the second action. And determining multi-frame skeleton animation data according to the starting position and the ending position of the second action. Preferably, the multi-frame skeletal animation data may be obtained by interpolation.
Each frame of skeletal animation data includes a root skeletal transformation matrix and a model transformation matrix. After the multi-frame bone animation data are obtained, updating the multi-frame bone animation data, and generating second action parameters by using the updated bone animation data so as to control the game animation model to complete the second action.
Preferably, the second motion is a turning motion, and the game animation rotates along the y coordinate axis when the turning motion is performed. When updating the bone animation data, processing the root bone transformation matrix according to the root bone transformation matrix to obtain an updated model transformation matrix, and setting the rotation angle on the y coordinate axis in the root bone transformation matrix to be zero to obtain an updated root bone transformation matrix so as to control the rotation angle of the model by using the rotation angle of the root bone. Wherein the y coordinate axis is a coordinate axis referred to when the game animation model completes the turning motion. The y coordinate axis is the coordinate axis of the coordinate system where the centroid of the game animation model is located.
Processing the root skeleton transformation matrix according to the root skeleton transformation matrix to obtain an updated model transformation matrix specifically comprises: and obtaining a difference value between a first angle and a second angle, wherein the first angle refers to the rotation angle on the y coordinate axis in the root bone transformation matrix of the ith frame of bone animation data, and the second angle refers to the rotation angle on the y coordinate axis in the root bone transformation matrix of the (i+1) th frame of bone animation data. I is more than or equal to 0 and less than or equal to n, wherein n is the total frame number of the skeletal animation data. And obtaining an updated model transformation matrix according to the angle difference value and the model transformation matrix.
After updating the skeletal animation data obtained by interpolation calculation, the updated skeletal animation data determines a second action parameter of the game animation model. The specific process is as follows: and determining the rotation angles of the game animation model in the x coordinate axis and the z coordinate axis according to the root skeleton transformation matrix, and determining the rotation angles of the game animation model in the y coordinate axis according to the transformation matrix of the game animation model. The x-coordinate axis and the z-coordinate axis are also coordinate axes of a coordinate system in which the centroid of the game animation model is located.
The process of obtaining skeletal animation data is illustrated below: and determining multi-frame bone animation data according to the starting position and the ending position of the second action by using interpolation method. Wherein M ci represents a model conversion matrix in the i-th frame of skeletal animation data,And (3) representing a root skeleton transition matrix in the ith frame of skeleton animation data, wherein i is a value from 0.
Extracting a root skeleton transformation matrix for each frame of skeleton animation dataThe rotation Euler angle y i along the rotation axis y converts the root bone into matrixIs set to 0 along the y-axis to obtain an updated bone transformation matrix
According to the formula delta yi=y i-yi-1, calculating to obtain the angle difference value of the rotary Euler angle along the turning axis y in two continuous frames of bone animation data. When i is zero, let y -1 =0. And generating a rotation matrix M Δyi according to the angle difference delta yi, and applying the rotation matrix M Δy to the model transformation matrix M ci, namely calculating according to a formula M 'ci=Mci·MΔyi to obtain an updated model transformation matrix M' c.
Through the steps, the y-axis angle difference value of each frame of the turning action of the root skeleton is transferred to the y-axis angle change of the model transformation matrix, so that the purpose of controlling the rotation of the model through the rotation of the root skeleton is achieved. Rotation data of other axes are applied to the root bone during the playing of the bone animation data, and rotation data along the turning axis are extracted from the root bone to be applied to rotation information of the space where the model is located.
That is, after it is determined that the playing of the bone animation data has been started, the bone animation data controls the motion parameters of the animation model, and the angle variation of the animation model in the direction of the body axis is the same as the control amount of the bone animation data to prevent the jumping of the angle variation of the animation model in the direction of the body axis, so that no key frame is required to be inserted during the transition of the bone animation data and the animation key frame.
For example: if the Unity 3D software is used to play the animation data, when the key frame meets the playing condition of the skeleton animation data, the Root Motion option is started, and the skeleton animation data controls the action parameters of the animation model, namely, a skeleton transformation matrix is usedAnd the model transformation matrix M' c controls the action parameters of the animation model.
S204, determining animation key frames at the fusion end time according to the end frames of the skeleton animation data.
The fusion end time is the corresponding time of the end frame of the skeleton animation data. In order to better fuse the animation key frames and the bone animation data, the animation key frames at the fusion end time are determined according to the end frames of the bone animation data, so that the third action parameters generated according to the animation key frames at the fusion end time are the same as the second action parameters generated according to the end frames of the bone animation data, and the action of the game animation model is prevented from jumping.
And S205, responding to the end of the second action, triggering a third action parameter for determining the game animation model according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
The step is already described in detail in S102, and the repetition is not described in detail.
And determining a third action parameter of the game animation model by fusing the animation key frames at the end time, so that the action of the game animation model at the end time of fusion is identical to the action of the game animation model controlled by the end frame of the skeleton animation data. The action of the game model is controlled in accordance with the later moment action key frame.
According to the game animation model control method provided by the embodiment of the application, when the game animation model is controlled by using the skeleton animation data, the influence of the animation key frame on the game animation model is shielded, and the rotation angle information of the root skeleton is transferred to the mass center of the game animation model, so that the key frame is not required to be inserted during the transition period of the skeleton animation data and the animation key frame, and the aim of reducing the difficulty in setting the key frame while maintaining good turning action quality is fulfilled.
The following describes a game animation model control method according to another embodiment of the present application with emphasis on specific examples, the game animation model control method comprising the steps of:
S301, determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter.
Wherein the animation key frames are determined according to the animation requirements. And determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter. And marks the key frame with the trigger time less than t m and closest to t m as f m-1, and the key frame with the trigger time greater than t n and closest to t n as f n+1. Where t m denotes a start frame of the bone animation data, and t n denotes an end frame of the bone animation data.
S302, determining an animation key frame at the fusion starting moment according to the initial frame of the skeleton animation data.
Wherein, the action parameters of the animation key frames at the fusion starting time are the same as the action parameters in the starting frames of the skeleton animation data.
When initializing the animation key frame, the bone animation data is scanned in advance to determine whether the game animation model is controlled by the bone animation data, if the game animation model is determined to be controlled by the bone animation data, a rotating key frame f m is inserted at the starting time t m, and the angle value is consistent with f m-1.
For example: as shown in fig. 4, when the animation data is played by using the Unity 3D software, a rotation key frame f m is inserted in real time at the start time t m when the Root Motion is applied to the scan skeleton Motion data, and the angle value is consistent with f m-1. Since keyframe f m-1 is immediately adjacent to f n+1 before keyframe f m is dynamically inserted, the turn-around action that begins at time t m requires taking the rotation value of keyframe f m-1 as the initial angle. Key frame f m is inserted to avoid the initial angle error of turning motion caused by the key frame interpolation of f m-1 and f n+1.
And S303, when the current animation key frame is the target key frame, triggering to determine second action parameters of the game animation model according to the skeleton animation data of the game animation model, and controlling the game animation model to execute the second action after the first action according to the second action parameters.
Wherein, the starting time of the turning action in the animation is defined as t m, and the ending time in the animation is defined as t n. Bone animation data between a start time t m and an end time t n are obtained by interpolation.
Updating the intermediate skeleton animation data of each frame so that the rotation angle in the root skeleton transformation matrix is transferred to the model transformation matrix, and the rotation of the root skeleton is transferred to the centroid of the game animation model.
S304, inserting a key frame in real time at the corresponding time of the ending frame of the skeleton animation data.
The method comprises the steps of obtaining the rotation angle y of an animation model of an end frame of skeleton animation data along a turning shaft, creating a key frame f n according to the y value, and inserting the key frame f n into a time t n of a key frame sequence. The action parameters of the inserted key frame are the same as the action parameters of the end frame of the skeletal animation data.
Since keyframe f m-1 is immediately adjacent to f n+1 before keyframe f n is dynamically inserted, the turning action ending at time t n needs to be concatenated with the rotation value of keyframe f n+1. The key frame f n is inserted, so that the angle error of turning motion caused by the key frame interpolation of f m-1 and f n+1 is avoided.
When the turning action ends or transitions to another action, a dynamic key frame is inserted at that time according to the y-axis orientation of the ending frame. The character orientation controlled by the key frame after the action is finished is consistent with the orientation of the action finishing frame, and the work of setting additional key frames in the animation editing stage is omitted.
At time t m, the application skeletal animation data is triggered, and the flag of the disabled keyframe is set to true. And controlling the action parameters of the animation model by the skeletal action data. When the operation is carried out to the time t n, the mark of the forbidden key frame is set to be false, and the action parameters of the animation model are controlled by the key frame.
And S305, responding to the end of the second action, triggering a third action parameter for determining the game animation model according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
The step is already described in detail in S102, and the repetition is not described in detail.
The following describes advantageous effects of the game animation model control method for the embodiment of the present application, using the animation data play scheme shown in fig. 1 as a comparative example.
As shown in fig. 1, the key frame f1 determines that the y-axis orientation of the character is 0 degrees before entering the turn-around action. In the pre-processing of playing the animation, a key frame f2 is dynamically added to ensure that the y-axis orientation of the character is 0 degrees at the latest moment before the turning action is triggered.
And starting the Root Motion to play skeleton Motion data of the turning Motion, controlling the game animation model by using the updated skeleton animation data, directly applying the rotation angle of the Root skeleton to the game animation model, controlling the y-axis angle of the game animation model along the turning axis to be 140 degrees by setting the skeleton animation data to the end frame of the skeleton animation data, and inserting the animation key frame at the fusion end time to realize fusion of the animation key frame and the skeleton animation data.
The game animation model control method provided by the embodiment of the application omits key frame setting during transition from the turning action to the follow-up action, so that the turning action can use a more complex angular velocity curve.
As shown in fig. 5, an embodiment of the present application provides an animation data playback apparatus 400, including:
The control module 401 is configured to determine a first action parameter of the game animation model according to the animation key frame, and control the game animation model to execute a first action in the game scene space according to the first action parameter;
The control module 401 is further configured to trigger to determine a second motion parameter of the game animation model according to the skeletal animation data when the current animation key frame is the target key frame, and control the game animation model to execute a second motion after the first motion according to the second motion parameter;
The control module 401 is further configured to trigger, in response to the end of the second action, determining a third action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter.
Optionally, the second action is a turning action, the skeletal animation data includes a root skeletal transformation matrix and a transformation matrix of the game animation model, and the control module 401 is specifically configured to:
determining the rotation angles of the game animation model in an x coordinate axis and a z coordinate axis according to the root skeleton transformation matrix;
determining the rotation angle of the game animation model in the y coordinate axis according to the transformation matrix of the game animation model;
Wherein the y coordinate axis is a coordinate axis referred to when the game animation model completes the turning motion.
Optionally, the apparatus further includes an obtaining module 402, where the obtaining module 402 is configured to:
determining multi-frame bone animation data according to the starting position and the ending position of the second action;
Processing the root skeleton transformation matrix according to the root skeleton transformation matrix to obtain an updated model transformation matrix;
Setting the rotation angle on the y coordinate axis in the root skeleton transformation matrix to be zero to obtain an updated root skeleton transformation matrix;
wherein each frame of skeletal animation data comprises a root skeletal transformation matrix and a model transformation matrix.
Optionally, the obtaining module 402 is specifically configured to:
obtaining an angle difference value according to the first angle and the second angle;
Obtaining an updated model transformation matrix according to the angle difference value and the model transformation matrix;
The first angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the ith frame of skeleton animation data, the second angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the (i+1) th frame of skeleton animation data, i is more than or equal to 0 and less than or equal to n, and n is used for identifying the total frame number of the skeleton animation data.
Optionally, the obtaining module 402 is further configured to:
determining an animation key frame at the fusion starting moment according to the initial frame of the skeleton animation data;
The fusion starting time is the initial frame corresponding time of the skeleton animation data.
Optionally, the obtaining module 402 is further configured to:
Determining animation key frames at the fusion end time according to the end frames of the skeleton animation data;
The fusion end time is the corresponding time of the end frame of the skeleton animation data.
Optionally, the obtaining module 402 is specifically configured to:
and determining multi-frame bone animation data according to the starting position and the ending position of the second action by using interpolation method.
As shown in fig. 6, the client 500 provided in this embodiment includes: a transmitter 501, a receiver 502, a memory 503, and a processor 504.
A transmitter 501 for transmitting instructions and data;
a receiver 502 for receiving instructions and data;
A memory 503 for storing computer-executable instructions;
A processor 504 for executing computer-executable instructions stored in a memory to implement the steps performed by the game animation model control method in the above-described embodiment. Reference may be made in particular to the description of the embodiments of the method for controlling a game animation model described above.
Alternatively, the memory 503 may be separate or integrated with the processor 504. When the memory 503 is provided separately, the client device further comprises a bus for connecting the memory 503 and the processor 504.
The embodiment of the application also provides a computer readable storage medium, wherein computer execution instructions are stored in the computer readable storage medium, and when the processor executes the computer execution instructions, the game animation model control method executed by the client device is realized.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.
Claims (9)
1. A game animation model control method, comprising:
determining a first action parameter of a game animation model according to an animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter;
when the current animation key frame is a target key frame, triggering a second action parameter of the game animation model according to skeleton animation data, and controlling the game animation model to execute a second action after the first action according to the second action parameter;
Triggering a third action parameter of a game animation model according to the animation key frame to be determined in response to the end of the second action, and controlling the game animation model to execute the third action after the second action according to the third action parameter;
The second action is a turning action, the skeletal animation data includes a root skeletal transformation matrix and a transformation matrix of a game animation model,
The determining the second action parameters of the game animation model according to the skeleton animation data specifically comprises:
determining the rotation angles of the game animation model in an x coordinate axis and a z coordinate axis according to the root skeleton transformation matrix;
Determining the rotation angle of the game animation model in a y coordinate axis according to the transformation matrix of the game animation model;
the y coordinate axis is a coordinate axis referred when the game animation model completes turning motion.
2. The method of claim 1, wherein prior to triggering the determination of the second action parameters of the game animation model from the preset skeletal animation data, the method further comprises:
Determining multi-frame bone animation data according to the starting position and the ending position of the second action;
Processing the root skeleton transformation matrix according to the root skeleton transformation matrix to obtain an updated model transformation matrix;
Setting the rotation angle on the y coordinate axis in the root skeleton transformation matrix to be zero to obtain an updated root skeleton transformation matrix;
wherein each frame of skeletal animation data comprises a root skeletal transformation matrix and a model transformation matrix.
3. The method according to claim 2, wherein the processing of the root skeletal transformation matrix to obtain an updated model transformation matrix comprises:
obtaining an angle difference value according to the first angle and the second angle;
obtaining an updated model transformation matrix according to the angle difference value and the model transformation matrix;
The first angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the ith frame of skeleton animation data, the second angle refers to the rotation angle on the y coordinate axis in the root skeleton transformation matrix of the (i+1) th frame of skeleton animation data, i is more than or equal to 0 and less than or equal to n, and n is the total frame number of the skeleton animation data.
4. The method according to claim 2, wherein determining multi-frame skeletal animation data from the start and end positions of the second action, in particular comprises:
and determining multi-frame skeleton animation data according to the starting position and the ending position of the second action by using interpolation method.
5. The method of any one of claims 1 to 4, wherein prior to determining the first action parameters of the game animation model from the animation keyframes, the method further comprises:
determining an animation key frame at the fusion starting moment according to the initial frame of the skeleton animation data;
Wherein the fusion start time is the initial frame corresponding time of the skeletal animation data.
6. The method of any one of claims 1 to 4, wherein prior to triggering the determination of a third operational parameter of the game animation model from the animation keyframes, the method further comprises:
Determining animation key frames at the fusion end time according to the end frames of the skeleton animation data;
The fusion end time is the corresponding time of the end frame of the skeleton animation data.
7. A game animation model control device, comprising:
the control module is used for determining a first action parameter of the game animation model according to the animation key frame, and controlling the game animation model to execute a first action in a game scene space according to the first action parameter;
The control module is also used for triggering to determine a second action parameter of the game animation model according to the skeleton animation data when the current animation key frame is a target key frame, and controlling the game animation model to execute a second action after the first action according to the second action parameter;
The control module is also used for responding to the end of the second action, triggering a third action parameter of the game animation model determined according to the animation key frame, and controlling the game animation model to execute the third action after the second action according to the third action parameter;
The second action is a turning action, the skeletal animation data includes a root skeletal transformation matrix and a transformation matrix of a game animation model,
The control module is specifically used for determining the rotation angles of the game animation model in an x coordinate axis and a z coordinate axis according to the root skeleton transformation matrix;
Determining the rotation angle of the game animation model in a y coordinate axis according to the transformation matrix of the game animation model;
the y coordinate axis is a coordinate axis referred when the game animation model completes turning motion.
8. An electronic device, comprising:
a memory for storing a program;
a processor for executing the program stored in the memory, the processor being configured to execute the game animation model control method according to any one of claims 1 to 6 when the program is executed.
9. A computer-readable storage medium having stored therein computer-executable instructions;
The computer-executable instructions, when executed by a processor, are for implementing the game animation model control method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011247097.8A CN112354186B (en) | 2020-11-10 | 2020-11-10 | Game animation model control method, device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011247097.8A CN112354186B (en) | 2020-11-10 | 2020-11-10 | Game animation model control method, device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112354186A CN112354186A (en) | 2021-02-12 |
CN112354186B true CN112354186B (en) | 2024-07-16 |
Family
ID=74508543
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011247097.8A Active CN112354186B (en) | 2020-11-10 | 2020-11-10 | Game animation model control method, device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112354186B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112891947B (en) * | 2021-04-02 | 2024-02-23 | 网易(杭州)网络有限公司 | Jump animation processing method, apparatus, electronic device and computer readable medium |
CN112948273B (en) * | 2021-04-16 | 2024-03-22 | 深圳市腾讯信息技术有限公司 | Game resource testing method, related device, equipment and storage medium |
CN113318439B (en) * | 2021-06-17 | 2024-05-28 | 网易(杭州)网络有限公司 | Method and device for processing starting animation, processor and electronic device |
CN115049767B (en) * | 2022-08-17 | 2022-11-04 | 深圳泽森软件技术有限责任公司 | Animation editing method and device, computer equipment and storage medium |
CN115618155B (en) * | 2022-12-20 | 2023-03-10 | 成都泰盟软件有限公司 | Method and device for generating animation, computer equipment and storage medium |
CN116894893A (en) * | 2023-09-11 | 2023-10-17 | 山东捷瑞数字科技股份有限公司 | Nonlinear animation regulation and control method and system based on three-dimensional engine |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108320322A (en) * | 2018-02-11 | 2018-07-24 | 腾讯科技(成都)有限公司 | Animation data processing method, device, computer equipment and storage medium |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2006122241A (en) * | 2004-10-27 | 2006-05-18 | Nintendo Co Ltd | Game device and game program |
KR100623173B1 (en) * | 2005-08-02 | 2006-09-12 | 엔에이치엔(주) | System for realizing animation of game-character and method for realizing and making the same |
CN104700444A (en) * | 2015-03-10 | 2015-06-10 | 上海鸿利数码科技有限公司 | Achievement method of picture animation |
CN111481928B (en) * | 2020-04-13 | 2023-04-07 | 网易(杭州)网络有限公司 | Animation loading method and device, server and storage medium |
CN111744195B (en) * | 2020-06-11 | 2024-03-22 | 北京冰封互娱科技有限公司 | Model control method and device, storage medium and electronic device |
CN111773686A (en) * | 2020-06-30 | 2020-10-16 | 完美世界(北京)软件科技发展有限公司 | Animation generation method and device, storage medium and electronic device |
CN111659115B (en) * | 2020-07-02 | 2022-03-11 | 腾讯科技(深圳)有限公司 | Virtual role control method and device, computer equipment and storage medium |
CN111773700B (en) * | 2020-07-24 | 2024-05-10 | 网易(杭州)网络有限公司 | Animation data processing method and device |
-
2020
- 2020-11-10 CN CN202011247097.8A patent/CN112354186B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108320322A (en) * | 2018-02-11 | 2018-07-24 | 腾讯科技(成都)有限公司 | Animation data processing method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN112354186A (en) | 2021-02-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112354186B (en) | Game animation model control method, device, electronic equipment and storage medium | |
CN111803946B (en) | Method and device for switching lenses in game and electronic equipment | |
CN108022286B (en) | Picture rendering method, device and storage medium | |
WO2022021686A1 (en) | Method and apparatus for controlling virtual object, and storage medium and electronic apparatus | |
US20170266491A1 (en) | Method and system for authoring animated human movement examples with scored movements | |
JP2021193599A (en) | Virtual object figure synthesizing method, device, electronic apparatus, and storage medium | |
JP5643617B2 (en) | Image processing program, image processing apparatus, image processing method, and image processing system | |
JP2981642B2 (en) | Video generator | |
US11783523B2 (en) | Animation control method and apparatus, storage medium, and electronic device | |
CN112891943A (en) | Lens processing method and device and readable storage medium | |
CN111292402A (en) | Data processing method, device, equipment and computer readable storage medium | |
CN112891947B (en) | Jump animation processing method, apparatus, electronic device and computer readable medium | |
JP4668321B2 (en) | Computer system and operation control method | |
CN111494948A (en) | Game lens editing method, electronic equipment and storage medium | |
CN112435314B (en) | Anti-threading method and device in game, electronic equipment and storage medium | |
CN111857666B (en) | Application method and device of 3D engine | |
CN108553900A (en) | A method of the stackable storage Reusability based on UE engines | |
CN114596394A (en) | Method, device, system and storage medium for generating bone animation | |
JP6827337B2 (en) | Sign language CG generator and program | |
CN118012272B (en) | Method, system and storage medium for switching virtual character actions based on context analysis | |
CN115588070B (en) | Three-dimensional image stylized migration method and terminal | |
CN116645434A (en) | Motion blur rendering method and device, electronic equipment and storage medium | |
CN117351125A (en) | Animation generation method, animation generation device, electronic device, and storage medium | |
US20240233231A1 (en) | Avatar generation and augmentation with auto-adjusted physics for avatar motion | |
CN114187391A (en) | Image processing method, system and equipment based on offline data and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |