Api Sandbox CharacterController
class

CharacterController

public class CharacterController : Component

Allows collision constrained movement without the need for a rigidbody. This is not affected by forces and will only move when you call the Move() method.

Constructors

CharacterController()

Properties

Name Type Description
Radius Single
Height Single
StepHeight Single
GroundAngle Single
Acceleration Single
Bounciness Single When jumping into walls, should we bounce off or just stop dead?
UseCollisionRules Boolean If enabled, determine what to collide with using current project's collision rules for the Tags of the containing GameObject.
IgnoreLayers TagSet
BoundingBox BBox
Velocity Vector3
IsOnGround Boolean
GroundObject GameObject
GroundCollider Collider

Methods

Void Accelerate(Vector3 vector)

Add acceleration to the current velocity. No need to scale by time delta - it will be done inside.

Void ApplyFriction(Single frictionAmount, Single stopSpeed = 140)

Apply an amount of friction to the current velocity. No need to scale by time delta - it will be done inside.

SceneTraceResult TraceDirection(Vector3 direction)

Trace the controller's current position to the specified delta

Void Punch(Vector3 amount)

Disconnect from ground and punch our velocity. This is useful if you want the player to jump or something.

Void Move()

Move a character, with this velocity

Void MoveTo(Vector3 targetPosition, Boolean useStep)

Move from our current position to this target position, but using tracing an sliding. This is good for different control modes like ladders and stuff.

Assembly: Sandbox.Engine Namespace: Sandbox Full Name: Sandbox.CharacterController