Motion Controller

Motions are activated by changing the player's state to the specified state that the motions use. For example, motions in the Default state are always updated, motions in the Walk state are only updated if the player's state changes to the Walk state.
Adding new Motions
To add a new Motion State, simply click the Add State button and select the state. To add motion to a state, simply click the plus (+) button next to the Motion Data title and select the motion module.

Creating new Motion Modules
Here is a simple script that creates spring-like motion:
using UnityEngine;
namespace UHFPS.Runtime
{
public class TestMotion : SpringMotionModule
{
public override string Name => "General/Test Motion";
public override void MotionUpdate(float deltaTime)
{
Vector3 position = Vector3.zero;
Vector3 rotation = Vector3.zero;
SetTargetPosition(position); // set position motion
SetTargetRotation(rotation); // set rotation motion
}
}
}
To create a simple motion, just derive it from the SimpleMotionModule. The newly created motions will be displayed when you click the plus button.

Last updated