CharacterControllerclass

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.

object→Component→CharacterController
Namespace
Sandbox
Assembly
Sandbox.Engine
Declaration
public class Sandbox.CharacterController : Sandbox.Component

Constructors1

Showing 1 constructors

Methods7

Showing 7 methods

public void Accelerate(Vector3 vector)PUBLIC

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

ParameterTypeDescription
vectorVector3—
Returns:void—

public void ApplyFriction(float frictionAmount, float stopSpeed = 140)PUBLIC

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

ParameterTypeDescription
frictionAmountfloat—
stopSpeed = 140float—
Returns:void—

protected virtual void DrawGizmos()PROTECTEDVIRTUAL

Returns:void—

public void Move()PUBLIC

Move a character, with this velocity

Returns:void—

public void MoveTo(Vector3 targetPosition, bool useStep)PUBLIC

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.

ParameterTypeDescription
targetPositionVector3—
useStepbool—
Returns:void—

public void Punch(Vector3 amount)PUBLIC

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

ParameterTypeDescription
amountVector3—
Returns:void—

Properties13

Showing 13 properties

public float Sandbox.CharacterController.Acceleration { get; set; }PUBLICGETSET

Returns:float—

public float Sandbox.CharacterController.Bounciness { get; set; }PUBLICGETSET

When jumping into walls, should we bounce off or just stop dead?

Returns:float—

public bool Sandbox.CharacterController.UseCollisionRules { get; set; }PUBLICGETSET

If enabled, determine what to collide with using current project's collision rules for the `Sandbox.GameObject.Tags` of the containing `Sandbox.GameObject`.

Returns:bool—

On this page