Animations can be used when other trackers are not tracking or not available. They can be enabled using the Animator option in the Input section of the Humanoid Control script.
By default, the animator uses a builtin procedural animation. This is overridden when setting the Runtime Animator Controller parameter which is standard Unity Animator Controller.
Humanoid Control can control the animator controller using a number of float Animation Parameters. These can be set in the Params section and refer to the Animation Parameters of the Animator Controller.
|float Forward Speed||The forward/backward speed. Negative is backward walking. Unit is units(meters) per second.|
|float Sideward Speed||The left/right speed. Negative is left strafing. Unit is units(meters) per second|
|float Turn Speed||The turning speed around the Y axis. Negative is turning left. Unit is full rotations (360 degrees) per second.|
|float Head Height||The head height relative to the standing position. Negative is crouching. Positive is reaching up. Unit is meters.|
Please note the unit of the parameters. Great care should be paid to this when creating the animations, because it is not possible to use root motion (see below).
If the animation root speed does not match the required units of speed, you can adjust them using the Speed parameter of the Animation State (see Unity3d – Animation States ).
For example, when the turning animation is set up such that it takes 4 seconds for a full rotation, the Speed parameter should be set to 0.25.
For the animations to work well they should not contain root motion. This is because we need to be able to move the character from the VR headset, not from the animation, or players will get motion sickness.
To get the right behaviour, ensure that the following options are checked on the imported animations:
Loop Time -> Loop Pose
Root Transform Rotation -> Bake Into PoseRoot Transform Position (Y) -> Bake Into Pose
Root Transform Position (XZ) -> Bake Into Pose
The animations are controlled by the Animation Parameters which are derived from the head movements. In order to match the movements of the player, the animations should be set in a specific way.
- The animation being player when Forward Speed = 1 should ensure that the head speed is exactly 1 unit(meter) per second. If the head speed in the animation is different you may see feet slipping over the ground because the animation is played too fast or too slow.
- The Forward Speed should only have effect on the forward/backward (Z-axis) speed of the avatar. If this is not ensured, the animations will be wrong. For example when the head moves to the left when forward speed = 1, the sideward speed will also be activated, resulting in unwanted animations.
- The same is true for the Sideward Speed and Turn Speed, but then limited to the sideward (X-axis) motion and rotation along the Y axis.
- The Head height is used to change the vertical position of the avatar. A value of -0.3 can result in a crouching with even lower values resulting in a crawling position. Positive values like 0.1 can result in a reaching position when the avatar stands on his toes.
- As with the other parameters, the Head Height parameter should only have effect on the Y position of the head. All other movements must be avoided in this animation.
When the Animation option is enabled on the Humanoid Control script, it is possible to select whether procedural animation should be used for each target. If Procedural Animation is deselected the animation controlled by the Runtime Animator Controller set in the Humanoid Control script will be used. If the Runtime Animator Controller is not set, no animation will be used.