quantum | v2 switch to V1  

3D Platformer Sample

Level Intermediate

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.

Back To Top
 

Download

Version Release Date Download
2.1.0 May 11, 2023 Quantum 3D Platformer 2.1.0 Build 218

Back To Top
 

Technical Info

The project has been developed with:

  • Unity 2021.3.6f1
  • Quantum 2.1.0

Back To Top
 

Screenshots

Moving Platform Gif
Rotating Platform Gif
Platform Vertical Gif

Back To Top
 

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.

Back To Top
 

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.

Back To Top
 

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.

Back To Top
 

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)

Back To Top
 

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.

Back To Top
 

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.

Back To Top
 

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.

Back To Top
 

Integration

1) Creating Your Own PlatformConfig

Navigate to any folder inside Resources/DB in the project.

Right click -> Create -> Quantum -> PlatformConfig

Creating Platform Config

Tweak the settings in the inspector window as desired

Editing Platform Config

Back To Top
 

2) Creating Your Own Platform

Navigate to or create a new Entity

Add a PhysicsCollider3D component and a Platform component.

Navigate to the previously created PlatformConfigAsset

Drag it into the Platform prototype component's Config field.

Setting Platform Config

Back To Top
 

3) Creating Your Own PlatformControllerConfig

Navigate to any folder inside Resources/DB in the project.

Right click -> Create -> Quantum -> PlatformControllerConfig

Creating Platform Config

Tweak the settings in the inspector window as desired

Editing Platform Config

Back To Top
 

4) Adding PlayerPlatformController

Navigate to or create a character you would like to add platform controlling functionality to.

Add a PhysicsCollider3D component, and a PlayerPlatformController component.

Navigate to thepreviously created PlatformControllerConfigAsset

Drag it into the PlayerPlatformController prototype component's Config field.

Setting Player Platform Config

To Document Top