Reversing Animation
In this section, we'll demonstrate how to animate a cube actor moving in the +Z direction, and then reverse the animation in the most efficient way possible.
Process
- Prepare a node tree consisting of
UserTrack
,UE5
, andSink
nodes, and activate the APM. - Spawn a Cube actor.
- Select the
UE5
node, then go to the Node Details Panel and expand Reality Actors. - Choose the Cube actor and expand its Properties panel.
- In the Transform property group, click on the Pin Switch button of the
Relative Location
property.
info
Alternatively, right-click on the Relative Location property and select Show as Input from the Property Context Menu.
- Create a
Cast vec3 to vec3d
node and connect itsvec3d
output to theCube.RelativeLocation
input pin of theUE5
node.
info
For better readability, optionally you can rename input and output pins by right-clicking on them or change the unique node name by using the Node Context Menu.
info
Cast vec3 to vec3d
node added to extract X
, Y
, and Z
property values to have absolute control over them.
- Create a new Action, optionally renaming it to something like First Animation.
- Select the Cast vec3 to vec3d node, then go to the vec3 property and click on the Add Timeline button.
info
Alternatively, right-click on the vec3
property and select the Timeline option from the Property Context Menu.
- Right-click on the property circle, add a keyframe, move the playhead to a different timestamp, and change the Z property from 0 to 200.
- Add another keyframe and change its interpolation to EaseInOut. Save the Action.
- Create another Action, optionally renaming it to something like Reverse Animation.
- Follow the same steps to add a timeline for the
vec3
property. - Go to the First Animation action, select the second keyframe, and copy it using
^ CTRL + C
. - Rectangle select the first keyframe to move the playhead to its exact timestamp.
- Switch to the Reverse Animation action and paste the copied keyframe at the beginning using
^ CTRL + V
. - Switch back to the First Animation action, select the first keyframe, and copy it.
- Rectangle select the first keyframe.
- Switch to the Reverse Animation action again and paste the copied keyframe as the first keyframe.
- Adjust the interpolation and save the Reverse Animation form.