Scripting API
Scripting API
CharacterController3D
Struct in Abyss.Physics3D, from Abyss.Physics3D.
A character, moved as it is told rather than pushed about as a body is: the Rigidbody 3D on its entity, moved as a Kinematic one whatever its Type, and its Capsule Collider 3D the shape it moves as, standing up — or its Box Collider 3D, square to the world, flat underneath: a box stands on an edge as long as any of it is over it and meets a wall flat, where a capsule rolls off an edge and, within its step, up one, which a block game does not want. Its Rigidbody 3D's LinearVelocity is where it goes — what code sets to walk it and to jump, what the last step left, less what went into a wall or a ceiling and, on the ground, its speed down — and its Gravity Scale how hard it falls.
public struct CharacterController3DRemarks
Each fixed step Jolt's character moves it along what it meets instead of into it: up a slope no steeper than CharacterController3D.SlopeLimit, which it stands on without sliding down; not up one steeper; up a step no higher than CharacterController3D.StepOffset; and down a slope or off a step kept to the ground within CharacterController3D.SnapToGround. Standing on a body that moves — a platform, an elevator — it is carried with it, and keeps the body's velocity as it jumps or walks off. A dynamic body in its way is pushed as its Rigidbody 3D's Mass says, by no more than CharacterController3D.MaxStrength, and what it stands on bears its weight. The world meets it as a Kinematic body: what falls on it rests on it, and triggers, queries and other characters find it.
What the last step left — CharacterController3D.IsGrounded, CharacterController3D.Ground, CharacterController3D.OnWall, CharacterController3D.OnCeiling — is what a system reads to decide what the character does next: a jump only from the ground, say. Up is against the gravity Physics 3D's settings say.
Fields
SlopeLimit
public float SlopeLimitThe steepest slope it stands on and walks up, in degrees from level; steeper is a wall.
StepOffset
public float StepOffsetThe highest step it walks up onto, in meters.
SnapToGround
public float SnapToGroundHow far below it ground is looked for as it walks down a slope or off a step, in meters, to stay on it.
MaxStrength
public float MaxStrengthThe most it pushes a dynamic body in its way with, in newtons.
IsGrounded
public bool IsGroundedWhether it stood on ground after the last step: something no steeper than CharacterController3D.SlopeLimit under it.
GroundNormal
public Vector3 GroundNormalThe normal of the ground it stood on, a unit long; zero off the ground.
Ground
public ulong GroundThe body it stood on — the entity with its Rigidbody 3D, or ground — or 0.
OnWall
public bool OnWallWhether something steeper than CharacterController3D.SlopeLimit was beside it after the last step.
OnCeiling
public bool OnCeilingWhether something was over it after the last step, facing down as steeply as a wall stands.
