Mix Gameplay and Sequencer Animation

What is mixed Gameplay and Sequencer animation?

The process of playing real-time character animation and pre-recorded Sequence animation together is called hybrid Gameplay and Sequence animation. They are switched through specific conditions. For example, when the mission reaches a death zone, the death animation is triggered.

When creating cutscene sequences, I always want to mix my cutscenes with real-time character animations, such as a death animation or a character opening a door, using Sequencers, Blueprints, and Animation Blueprints combined together. Mix the game Pose where the character is animated with the Slot animation defined by Sequence.

How to implement mixed Gameplay and Sequencer animations

The core idea is to use BlendPose to mix two Pose in the animation blueprint animation chart, where Alpha needs to be modified according to external conditions, such as changing from 0 to 1 after reaching the trigger box area. Playing the death animation is the core of implementing hybrid animation.

Now we create a death state when the character enters a Trigger Box and mixes the death animation.

1. We need a death animation, here we use the official animation beginner package

2. Use the third-person template project, add the animation starter package Add project, delete the third-person character from the level, add Ue4ASP_Character, and set the Auto Possess Player to Player 0. Ensure that our death animation can be used normally. Check the capsule's attribute Hide in Game.

3. Create a new Level Sequence, add Ue4ASP_Character and an Animation Track, and specify Death_3.

4. Right-click the animation in the keyframe window, change WhenFinished to Keep Stat in the properties, keep the sequence playing, and ensure that the character does not come back from the dead. Save the death state. There is a Slot Name property in Animation. When the animation blueprint controls a Skelenten mesh, the Sequencer plays the animation on the slot of the animation blueprint and controls it through the Slot Name property. Then the animation blueprint can Mix slot animations and game logic driven animations.

5. In the animation blueprint, add a node blend, put the output pose of the state machine into the cache pose, use the slot named default slot (it contains the death animation), use the blend node to mix the two poses, and add Alpha Promoted to a variable.

6. Open Ue4ASP_Character, add a variable name of DefaultSlotAlpha, check Instance Editable, Expose on Cinematics, and expose the variable to level sequence.

7. Because a DefaultSlotAlpha variable was created above and can be accessed in the sequence, you can add the variable to the sequence, and then use the proxy in the sequence (when a certain attribute value changes, the corresponding Set(attribute (name) method) to update the value: When the property in the sequence changes, the set[property] function will be called.

By obtaining the animation blueprint, and then setting the variable Alpha in the animation blueprint, the animation is updated by updating the Alpha of blend.

Set the keyframes in DefaultSlotAlpha in sequence.

8. Create a Trigger box. When the player enters the collision area, the animation in the sequence starts to play, and the sequencedefaultSlotAlpha will also change accordingly.

Now you can run the test.

Summarize:

1. Use Blend to blend the animation and adjust it through Alpha.

2. Set the attribute values ​​in the animation blueprint by obtaining the animation capabilities of the mesh in the blueprint class.

3. Expose the property value to sequence in the blueprint class, create a keyframe, and when the value changes, the Set[Property] method will be called.

4. You can add the animation in the sequence to the Slot in the animation blueprint, and call the corresponding animation through Slot[Slot SlotName].

Guess you like

Origin blog.csdn.net/weixin_41363156/article/details/114380885