LocomotionEvent has a Translation Type, a Rotation type , and a Pose indicating the parameters for this movement. The Pose.position indicates the Translation parameter and Pose.rotation the rotation parameter.| LocomotionEvent Type | Description | Example of use |
|---|---|---|
Translation.Absolute | The pose.position indicates the absolute world position desired for the character’s feet. | Teleport to the mirror. |
Translation.AbsoluteHead | The pose.position indicates the absolute world position desired for the character’s head. | Use this when the player head final positioning is more important than the character’s height, for example when seating in a virtual low chair. |
Translation Relative | The pose.position indicates a Relative discrete movement. | Take a step backwards. |
Translation Velocity | The pose.position indicates a velocity to be applied in that frame. | Move in the world forward direction at 1 m/s |
Turning Absolute | The pose.rotation indicates the absolute world rotation desired for the character. | Face the mirror. |
Turning Relative | The pose.rotation indicates a relative rotation around the player’s head. | Snap rotate 45 degrees to the left. |
Teleport Velocity | The pose.rotation indicates an angular velocity to be applied in that frame. | Rotate at 90 degrees per second to the right |
ILocomotionEventBroadcaster is used for sending events. TurnerInteractor and TeleportInteractor implement it.ILocomotionEventHandler is used for handling locomotion events. The component PlayerLocomotor implements it to listen to all incoming locomotion events and move the player at the end of the current frame when all updates have finished. This ensures no glitches happen and that the next frame is executed with all transforms correctly updated.LocomotionEventsConnection collects several broadcasters at the interactors level and links them to one handler instead of directly pointing from a handler to several broadcasters.Disabled, Normal, Hover or Selected) and an axis 1D value (from -1 to 1).
TurnerEventBroadcaster then reads these two values and generates the desired events. It supports two different turning modes: Snap and Smooth.Snap turning, TurnerEventBroadcaster will fire a turning event once during select (either at the beginning or the end of the selection), which indicates that a Snap Turn Degrees instant rotation relative to the player should occur.Smooth turning, TurnerEventBroadcaster will continuously fire events during select, indicating that the player should rotate at the rate specified in Smooth Turn Curve.StepLocomotionBroadcaster generates relative translation events that request to move the player for a discrete amount in the ground plane.SlideLocomotionBroadcaster generates continuous translation events that requests to move the player at a specified velocity above the ground plane.LocomotionActionsBroadcaster generates locomotion events without translation or rotation, but instead decorates them with action information. These action events allow for sending instantaneous locomotion commands through the locomotion event pipeline.LocomotionEvent instances by using the decoration system. The events themselves are empty, meaning they contain Translation.None and Rotation.None values.LocomotionActionsBroadcaster creates these decorated events and immediately disposes of the decoration after broadcasting them.LocomotionEvent is created and decorated with an action type using CreateLocomotionEventAction()WhenLocomotionPerformedTryGetLocomotionActions() to extract the actionDisposeLocomotionAction() to prevent memory buildup| Action Type | Description |
|---|---|
Crouch | Initiates crouching |
StandUp | Exits crouching state |
ToggleCrouch | Toggles between crouching and standing |
Run | Activates running mode |
Walk | Deactivates running mode |
ToggleRun | Toggles between running and walking |
Jump | Performs a jump action |
InvalidTarget | Indicates an invalid locomotion target. Use this for feedback like triggering a denied sound when selecting a restricted area. |
Select | Sends a generic select action through the locomotion pipeline |