This locomotion handler will respond to locomotion events by moving a character represented as a CapsuleCollider and keep it in sync with the VR player (represented by its root transform and the center eye transform).
Appart from the locomotion event types it can also react to external calls for jumping, crouching or running. When moved using velocities, the character will collide with the world, preventing the capsule from penetrating through colliders or falling through the floor.
Velocity is applied during Update, but other
Locomotion events are not applied instantly, instead they are collected and applied all once at the end of the frame to avoid desyncs between interactions.
Translation events: LocomotionEvent.Translation.Velocity: will add to the current velocity of the character and a delta will be applied every update to the capsule, checking for collisions and also dampening the velocity along time. LocomotionEvent.Translation.Relative: will move the character in the requested direction by also checking for collisions. LocomotionEvent.Translation.Absolute: will move the character's feet to the requested position while trying to snap it to the ground if found under the requested pose. LocomotionEvent.Translation.AbsoluteEyeLevel: will move the character so it's head ends up placed at the requested pose (not the feet). By doing this the capsule can potentially become missaligned with the ground so physics will be disabled until a new event is registered, the player physically moves _exitHotspotDistance or EnableMovement is called manually.
Rotation events: LocomotionEvent.Rotation.Velocity: will rotate the character by this angular velocity using the provided delta time. LocomotionEvent.Rotation.Absolute: will force the character to face the requested absolute rotation. LocomotionEvent.Rotation.Relative: will force the character to rotate the requested amount.
Other behaviors: When Player transforms are provided, the height of the capsule will stay in sync with the actual player height (distance from the top of their head to their floor), when the heigth increases it will also check for collisions above to avoid the character from clipping with low ceilings and other obstacles. When the character and player transforms difer more than _maxWallPenetrationDistance, the player will instantly be teleported to the character position if an input is registered. This can be manually controller by calling ResetPlayerToCharacter manually. When moving using Translation.Velocity or Translation.Relative, if a collision against a wall is registered, the capsule will try to rebound and slide along it using _maxReboundSteps iterations.