Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


CharacterController

A CharacterController allows you to easily do movement constrained by collisions without having to deal with a rigidbody.
Read time 8 minutesLast updated 2 days ago

Definition

  • Type: Class
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule
  • Inherits from: Collider
public class CharacterController : Collider

Remarks

A CharacterController is not affected by forces and will only move when you call the Move function. It will then carry out the movement but be constrained by collisions.

Properties

Property

Description

centerThe center of the character's capsule relative to the transform's position.
collisionFlagsWhat part of the capsule collided with the environment during the last CharacterController.Move call.
detectCollisionsDetermines whether other rigidbodies or character controllers collide with this character controller (by default this is always enabled).
enableOverlapRecoveryEnables or disables overlap recovery. Enables or disables overlap recovery. Used to depenetrate character controllers from static objects when an overlap is detected.
heightThe height of the character's capsule.
isGroundedWas the CharacterController touching the ground during the last move?
minMoveDistanceGets or sets the minimum move distance of the character controller.
radiusThe radius of the character's capsule.
skinWidthThe character's collision skin width.
slopeLimitThe character controllers slope limit in degrees.
stepOffsetThe character controllers step offset in meters.
velocityThe current relative velocity of the Character (see notes).

Methods

Method

Description

MoveSupplies the movement of a GameObject with an attached CharacterController component.
OnControllerColliderHitOnControllerColliderHit is called when the controller hits a collider while performing a Move.
SimpleMoveMoves the character with speed.

Inheritance

Inherited Members

Operators

Operator

Description

operator ==Compares two object references to see if they refer to the same object.
boolDetermines whether the object exists.
operator !=Compares if two objects refer to a different object.