Skip to content

Class CharacterController

Namespace: Apogee.Physics
Assembly: Apogee.Physics.dll

A walking character: a capsule that slides along walls, climbs stairs and slopes, sticks to the ground going down and stands on moving platforms, without being a rigid body (Jolt's CharacterVirtual). Make one with ; it moves in every fixed step toward , and its entity's transform (the feet) follows, blended between steps like a dynamic body's. Dynamic bodies are pushed by it and do not push it.

public sealed class CharacterController : EngineObject

Inheritance

object ← EngineObject ← CharacterController

Inherited Members

EngineObject.IsAdopted, EngineObject.Handle, EngineObject.IsDestroyed, EngineObject.Class, EngineObject.Adopt(), EngineObject.TryGet(SlotHandle, out EngineObject), EngineObject.Destroy(), object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Properties

Class

What the registry knows about this object's class.

public override ClassInfo Class { get; }

Property Value

ClassInfo

DesiredVelocity

The velocity the character tries to have, in meters per second, in world space. Only the horizontal part matters: gravity and jumps decide the vertical one.

public Vector3 DesiredVelocity { get; set; }

Property Value

Vector3

Entity

The entity that follows the character.

public Entity Entity { get; }

Property Value

Entity

GroundVelocity

The velocity of the ground under the character (a moving platform), or zero in the air.

public Vector3 GroundVelocity { get; }

Property Value

Vector3

IsOnGround

Whether the character stands on something that holds it (not a slope too steep to stand on).

public bool IsOnGround { get; }

Property Value

bool

MaxSlopeDegrees

The steepest slope in degrees the character can stand and walk on.

public float MaxSlopeDegrees { get; }

Property Value

float

Position

Where the feet are, after the last step.

public Double3 Position { get; }

Property Value

Double3

Velocity

How fast the character actually moved in the last step.

public Vector3 Velocity { get; }

Property Value

Vector3

Methods

Jump(float)

Starts a jump of this upward speed (m/s) at the next step, if the character is on the ground then.

public void Jump(float speed)

Parameters

speed float

OnDestroyed()

protected override void OnDestroyed()

SetRotation(Quaternion)

Turns the character about its up axis (its entity follows).

public void SetRotation(Quaternion rotation)

Parameters

rotation Quaternion

Teleport(Double3)

Puts the character (its feet) here at once; its entity follows with no blend.

public void Teleport(Double3 position)

Parameters

position Double3