Character Movement

Description

The CharacterMovement component is a robust and feature-rich fully kinematic character controller, also known as a motor.

It has been developed as a compelling alternative to Unity's character controller, maintaining the familiar workflow through functions like Move / SimpleMove, while surpassing it with a myriad of enhanced features and advantages.

What is a character controller ?

A Character Controller facilitates straightforward movement constrained by collisions, eliminating the need to grapple with a dynamic Rigidbody.

Unlike a dynamic Rigidbody, a Character Controller remains unaffected by forces and will only initiate movement upon calling the Move function. Subsequently, it executes the intended movement while adhering to collision constraints.

In the earlier days of gaming, titles didn't rely on a 'true' physics engine like the PhysX SDK (Unity's underlying physics engine). However, they still employed a character controller to navigate players within a level. Games like Quake or Doom utilized a bespoke piece of code for collision detection and response, often constituting the sole physics aspect in the entire game. While these implementations lacked extensive physics, they heavily leaned on meticulously adjusted values to deliver an immersive player experience. The specific algorithm governing their behavior is commonly known as the 'collide and slide' algorithm, refined over more than a decade for optimal performance.

The CharacterMovement component is an implementation of such an algorithm, delivering a reliable and widely recognized behavior for character control.

The Character Movement Component

Character Movement Component
Property:
Function:

Plane Constraint

Allow to constrain the Character so movement along the locked axis is not possible.

Root Transform

The root GameObject of your character's model.

Root Transform Offset

The root transform will be positioned at this offset from foot position.

Radius

The Character's capsule collider radius.

Height

The Character's capsule collider height.

Slope Limit

The maximum angle (in degrees) for a walk-able surface.

Step Offset

The maximum height (in meters) for a valid step.

Perch Offset

Allow a Character to perch on the edge of a surface if the horizontal distance from the Character's position to the edge is closer than this.

Perch Additional Height

When perching on a ledge, add this additional distance to step offset when determining how high above a walk-able ground we can perch.

Slope Limit Override

If enabled, colliders with SlopeLimitBehaviour component will be able to override this slope limit.

Use Flat Top

If enabled, will treat head collisions as if the character is using a shape with a flat top.

Use Flat Base For Ground Checks

If enabled, performs ground checks as if the character is using a shape with a flat base. This avoids the situation where characters slowly lower off the side of a ledge (as their capsule 'balances' on the edge).

Collision Layers

Character collision layers mask.

Trigger Interaction

Overrides the global Physics.queriesHitTriggers to specify whether queries (raycasts, spherecasts, overlap tests, etc.) hit Triggers by default.

Advanced:

Min Move Distance

The minimum move distance of the character controller. In most situations this value should be left at 0.

Max Movement Iterations

Max number of iterations used during movement.

Max Depenetration Iterations

Max number of iterations used to resolve penetrations.

Enable Physics Interactions

If enabled, the character will interact with dynamic rigidbodies when walking into them.

Allow Push Characters

If enabled, the character will interact with other characters when walking into them.

Impart Platform Movement

If enabled, the character will move with the moving platform it is standing on.

Impart Platform Rotation

If enabled, the character will rotate (yaw-only) with the moving platform it is standing on.

Impart Platform Velocity

If enabled, impart the platform's velocity when jumping or falling off it.

Details

The CharacterMovement component, in addition to its primary function of constrained movement by collision, offers a broad range of specifically designed functions to leverage its capabilities to the fullest.

Properties

Public Methods

Callbacks

Events

Last updated