In this tutorial learn how to add custom animations to agent avatars in RIDE, including a simple debug selection menu.
How to Use
Note, the referenced example scene may utilize a different custom animation than the one described.
Using Animation Control Debug Menu
- At runtime, click on the agent avatar in the game window to bring up commands in the debug menu.
- Click on Custom0 to command agent to play golf swing animation.
- Click on MoveTo… to command the agent to move to another point on the plane.
Adding Custom Animation
This tutorial will show how to add custom animation using an animation clip from Mixamo.
- Go to mixamo.com and download the desired animation.
- Import the animation asset to Unity. Click on the animation clip asset and go to edit in the inspector window.
- Go to Rig and set Animation Type to Humanoid. Click Apply.
- In Unity, go to Window→Animation→Animator to bring up an Animator window.
- Open PlayerAnimator animation controller asset in the Animator window. Click on the Custom0 state from the Animator window.
- Select desired animation from the Motion tab from the Inspector window.
- Play the ExampleCustomAgentAnimations scene and click on the agent in the scene. Click on Custom0 from the debug menu to see the agent playing new animation.
- Otherwise, call PlayCustomAnimation0() function from Agent_SimpleAnimationController.cs from a separate script.
Adding Additional Slots for Custom Animations
- Open PlayerAnimator animator asset and right-click on the Animator window.
- Select CreateState→ Empty and name the new state as desired.
- Right-click on the newly created state and select MakeTransition.
Left-click on Base state to guide arrow from new state to Base state.
- Follow the instruction above to add a new Animation clip to the new state.
- Open Agent_SimpleAnimationController.cs. Duplicate the following function and change function name. (Ex: PlayCustomAnimation4() → PlayCustomAnimation5())
- Replace “Custom#” inside the body of the function with the name of the newly created state.
- Open AnimationTesting_Menu.cs and duplicate following function: (This step is only for when you are using ExampleCustomAgentAnimations scene)
- Replace “Custom#” with the desired name for a label on the debug menu button.
- Replace PlayCustomAnimation# in the body of the function with the name of the function created in the Agent_SimpleAnimationController.cs.
- Save both scripts and return the Unity to test out new animation.
Scene Location & Name
Unity Animation Override Controller
Animation Override Controller from Unity allows users to replace specific animations while retaining the base animation controller’s structure and parameters (https://docs.unity3d.com/Manual/AnimatorOverrideController.html). However, RIDE does not incorporate this mechanic because it lacks the desired flexibility; Animation Override Controller does not have the capability of modifying states and blending settings.
Virtual Human Animation Controller
Virtual Human characters use a separate animation controller from this tutorial and do not support custom animations at the moment.