Class MecanimBridge Extends VersionedMonoBehaviour

Public

Example of how to use Mecanim with the included movement scripts.

This script will use Mecanim to apply root motion to move the character instead of allowing the movement script to do the movement.

It assumes that the Mecanim controller uses 3 input variables

  • InputMagnitude which is simply 1 when the character should be moving and 0 when it should stop. Or, for the FollowerEntity component, 1 when it is moving at its natural speed, and less than 1 when it is moving slower.

  • X which is component of the desired movement along the left/right axis. For the AIPath and RichAI movement scripts, this will be a velocity in meters/second, while for the FollowerEntity movement script, this will be an angular velocity in radians/second.

  • Y which is component of the desired movement direction along the forward/backward axis. This is a velocity in meters/second.

It works with the AIPath, RichAI and FollowerEntity movement scripts.

Public Variables

angularVelocitySmoothing

Smoothing factor for the angular velocity, in seconds.

Public
naturalSpeed
Public
velocitySmoothing

Smoothing factor for the velocity, in seconds.

Public

Private/Protected Members

Awake ()
Protected
CalculateBlendPoint ()

Calculate position of the currently grounded foot.

Private
HasParameter (animator, paramName)
Private Static
InputMagnitudeKey
Private Static
InputMagnitudeKeyHash
Private Static
MovementOverride (entity, dt, localTransform, shape, movementPlane, destination, movementState, movementSettings, movementControl, resolvedMovement)
Private
NormalizedSpeedKey
Private Static
NormalizedSpeedKeyHash
Private Static
OnAnimatorMove ()
Private
OnDisable ()
Private
OnEnable ()
Private
OnUpgradeSerializedData (migrations, unityThread)

Handle serialization backwards compatibility.

Protected
Reset ()

Handle serialization backwards compatibility.

Protected
RotatePointAround (point, around, rotation)
Private Static
RotateTowards (direction, maxDegrees)

Calculates a rotation closer to the desired direction.

Protected
Update ()

Update is called once per frame.

Private
UpgradeSerializedData (isUnityThread)
Protected
XAxisKey
Private Static
XAxisKeyHash
Private Static
YAxisKey
Private Static
YAxisKeyHash
Private Static
ai

Cached reference to the movement script.

Private
anim

Cached Animator component.

Private
footTransforms

Cached reference to the left and right feet.

Private
prevFootPos

Position of the left and right feet during the previous frame.

Private
smoothedRotationSpeed
Private
smoothedVelocity
Private
tr

Cached Transform component.

Private