3D Platformer Sample
Overview
Moving platforms are a common feature in many modern games, but creating them can be deceptively tricky.
This sample demonstrates how to create a moving platform system using the default 3D Kinematic Character Controller (KCC).
It is a good starting point for implementing your own movement systems to drive more complex behaviour.
Download
Version | Release Date | Download | |
---|---|---|---|
2.1.8.1 | May 07, 2024 | Quantum 3D Platformer 2.1.8.1 Build 378 |
Technical Info
The project has been developed with:
- Unity
2021.3.6f1
- Quantum
2.1.0
Screenshots
Highlights
FPAnimationCurve Usage
The use of FPAnimationCurve
in the movement and rotation systems allows the user to specify the precise shape of the Platform's movement or rotation, including any sudden changes in direction or speed. Additionally, the use of pre-defined curves makes the code easier to read, as it eliminates the need for manual specification of the platform's movement at each point in time.
Inertia
This technical sample includes the option in the PlayerPlatformControllerAsset
to transfer the platform's inertia to the player when they exit the platform. The platform's velocity is then applied to the player until they hit the ground or a new platform.
Description
1) Sample Scene
Select the scene dropdown menu in the editor window and click the "Game" scene.
This scene provides a general example of what a platform layout would look like in game.
2) PlatformConfig
This technical sample utilizes the PlatformConfig
asset in order to make moving platform behaviour easy to understand and manipulate.
Field | Description |
---|---|
MovementAmplitude | The amplitude of the movement related curves. |
RotationAmplitude | The amplitude of the rotation related curves. |
MovementAxis | Flags for which axis movement should be applied to. |
XMovementCurve | The movement curve for the X axis. |
YMovementCurve | The movement curve for the Y axis. |
ZMovementCurve | The movement curve for the Z axis. |
RotationCurve | The rotation curve to be applied (Y axis) |
3) Platform Component
The Platform
component identifies an entity as a valid platform and contains the necessary data to move it.
Field | Description |
---|---|
Config | The PlatformConfig asset to use for this platform instance. |
4) PlatformControllerConfig
The PlatformControllerConfig
asset is used to configure how the player interacts with the platforms.
Field | Description |
---|---|
ApplyRotationInertia | Whether or not to apply rotation inertia after exiting a platform. |
PlatformAxisInertia | Defines what axis should the inertia be applied on. |
5) PlayerPlatformController Component
The PlayerPlatformController
component defines an entity that can interact with Platform
entities.
Field | Description |
---|---|
Config | The PlatformControllerConfig to use for this controller instance. |
Integration
1) Creating your own PlatformConfig
Navigate to any folder inside Resources/DB
in the project.
Right click -> Create -> Quantum -> PlatformConfig
Tweak the settings in the inspector window as desired
2) Creating your own Platform
Navigate to or create a new Entity
Navigate to the previously created PlatformConfigAsset
Drag it into the Platform
prototype component's Config
field.
3) Creating your own PlatformControllerConfig
Navigate to any folder inside Resources/DB
in the project.
Right click -> Create -> Quantum -> PlatformControllerConfig
Tweak the settings in the inspector window as desired
4) Adding PlayerPlatformController
Navigate to or create a character you would like to add platform controlling functionality to.
Add a PlayerPlatformController
component.
Navigate to thepreviously created PlatformControllerConfigAsset
Drag it into the PlayerPlatformController
prototype component's Config
field.