The moving platforms are a generic term meaning any object that can be moved/rotated within the scene. This includes elevators, trains, revolving doors, etc. The character can ride on top of or get pushed around by these moving platforms.
In order to stay properly synchronized with the character and camera the object must use the Moving Platform layer:
The Moving Platform or Animator Update component must be added to your movable object. The Moving Platform component should be used for any object that does not have an Animator. The Animator Update component is then used with the Animator.
One of these scripts must be attached in order to prevent the character from jittering on a moving platform. The Kinematic Object Manager updates the objects in a specified order to allow for the smooth movement and without one of these scripts attached the Kinematic Object Manager will not know the moving platform exists.
Moving Platform Component
The Moving Platform component allows the object to move or rotate along a given waypoint path. An outline will show the shape of the object at each waypoint object, and a line will connect the waypoints indicating the path that will be traversed.
Moving platforms can be setup by following:
- Create a new empty GameObject that will act as the container for the actual moving platform object and waypoints.
- Add your platform that will actually move as a child of the GameObject created in step 1. The Moving Platform component and any colliders should be added to this GameObject. This GameObject should be on the MovingPlatform.
- Add any number of child GameObjects to the GameObject created in step 1. These GameObjects will serve as the waypoints that the platform will traverse.
- Each waypont should be specified in the Waypoints list under the Moving Platform component.
Specifies the location that the object should be updated:
- Update: The object will be updated within Unity’s Update loop.
- FixedUpdate: The object will be updated within Unity’s FixedUpdate loop.
The Waypoints that the moving platform will traverse. If no waypoints are set then the object will not change positions. With each waypoint a delay and state name can be specified along with the platform. The platform will stay at the waypoint for the specified delay and activate specified state when the platform start to traverse towards that waypoint.
Specifies the direction that the platform should traverse.
- Forward: Moves from the waypoint at the least index to the greatest index within the waypoints array.
- Backwards: Moves from the waypoint at the greatest index to the least index within the waypoints array.
Specifies how the platform traverses through waypoints.
- Ping Pong: Moves to the last waypoint and then back the way it came from.
- Loop: Moves to the last waypoint and then directly to the first waypoint.
- Target: Moves to the specified waypoint index.
Specifies the waypoint index to move towards if using the Target Movement Type.
The speed at which the platform should move.
Specifies how the platform should interpolate the movement speed.
- Ease In Out: Gently moves into full movement and gently moves out of it at each waypoint.
- Easy In: Gently moves into full movement.
- Ease Out: Moves into full movement immediately and gently moves out of full movement at each waypoint.
- Ease Out 2: Moves into full movement immediately and moves out of full movement according to the movement speed.
- Slerp: Uses Vector3.Slerp to move in and out of movement according to the movement speed.
- Lerp: Uses Vector3.Lerp to move in and out of movement according to the movement speed.
Specifies how the platform should interpolate the rotation speed.
- Sync To Movement: Rotates according to the movement speed.
- Ease Out: uses Quaternion.Lerp to lerp the rotation based on a linear curve.
- Custom Ease Out: Uses Quaternion.Lerp to lerp the rotation based on the Rotation Ease Amount value.
- Custom Rotate: Rotates according to the rotation speed.
Rotation Ease Amount
Specifies the amount to ease into the target rotation if using the Custom Ease Out Rotation Interpolation mode.
Custom Rotation Speed
Specifies the rotation speed if using the Custom Rotate Rotation Interpolation Mode.
Max Rotation Delta Angle
The maximum angle that the platform can rotation. Set to -1 to have no max angle.
Character Trigger Layer
The layer of the character that can activate the moving platform.
Character Trigger State
The state name that should activate when the character enters the platform trigger. Note that the platform must have a trigger collider in order for the state to be activated.
Enable On Interact
Should the moving platform wait to be enabled until it is interacted with? The Interact ability can start the interaction.
Change Directions On Interact
Should the moving platform change directions when the Interact ability interacts with the platform? The Interact ability can start the interaction.
The color to draw the editor gizmo in (editor only).
Draw Debug Labels
Should the delay and distance labels be drawn to the scene view (editor only)?