⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    Motion Graph Moving Platforms

    Overview

    A moving platform is a kinematic or dynamic rigidbody that the player can stand on. The player will move and rotate with the moving platform.

    Moving Platforms

    For a demonstration of the moving platforms, you can check out the sample scene.

    How To Set Up A Moving Platform

    Creating a moving platform is relatively simple. The key things that need setting up correctly are the rigidbody and the object layers.

    Moving Platform Setup

    In the above image there are 2 objects. The first is the physical platform that the character interacts with. This uses one or more primitive colliders to define a rough shape and should be set to use the Moving Platform layer. It also requires an object that derives from the IMovingPlatform interface or BaseMovingPlatform abstract class. These communicate with the NeoCharacterController to smoothly move the character. Moving platform movement should always be handled through the Rigidbody move and rotate methods. NeoFPS relies on rigidbody interpolation to get smooth interpolation between the fixed update frames. You should use Rigidbody.MovePosition() and Rigidbody.MoveRotation() instead of setting the position and rotation directly. If you don't do this, then the platforms will appear to stutter when you ride them.

    The second object is the render geometry. This should be set to use the EnvironmentDetail layer and the collider should match the render geometry as closely as possible.

    When a character is in contact with the moving platform it will match any change of position or rotation of the platform each frame. Any character movement will be additive on top of this.

    Example Moving Platform Behaviours

    NeoFPS comes with the following moving platform types already implemented, though it is easy to add more with scripting:

    Name Description
    SimpleMovingPlatform The SimpleMovingPlatform behaviour is used to create a platform that moves between 2 points at set intervals.
    SimpleRotatingPlatform The SimpleRotatingPlatform behaviour is used to create a platform that rotates at set intervals.
    ConstantRotatingPlatform The ConstantRotatingPlatform behaviour is used to create a platform that constantly turns at a set rate.
    DrivenMovingPlatform The DrivenMovingPlatform behaviour is added to a rigidbody that is driven by physics or a script and turns it into a moving platform. See the above note on rigidbody interpolation.
    WaypointMovingPlatform The WaypointMovingPlatform behaviour is used to create a platform that moves between a set of waypoints in sequence or directly.
    ElevatorMovingPlatform The ElevatorMovingPlatform behaviour is used to control the movement of an elevator cab. It is attached to the kinematic rigidbody that acts as the elevator cab or platform, and moves the character smoothly with it.

    See Also

    NeoCharacterController

    The Motion Graph

    The Motion Graph Editor

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX