API reference
API reference
Select your platform
No SDKs available
No versions available

CharacterController Class

Extends MonoBehaviour
This component moves a physics capsule collider around the scene checking for collisions, steps and slopes.
It will also resolve collisions with surfaces sliding along them.

Properties

float SkinWidth[Get]
LayerMask LayerMask[Get]
float MaxSlopeAngle[Get]
float MaxStep[Get]
int MaxReboundSteps[Get]

Fields

Whether the capsule is touching the ground
Actual height of the capsule
Radius of the capsule
Current Pose of the capsule

Protected Fields

RaycastHit _groundHit[Get]
bool _isGrounded[Get]
bool _started[Get]

Protected Functions

virtual void Start ( )
virtual void OnEnable ( )

Member Functions

Attemps to set the height of the capsule.
If the requested height is higher than the current height, it will check for collisions above the top and set the height to the maximum possible value withhin the range. It will ignore calls if the delta is smaller than the skin of the character.
Parameters
desiredHeight
The desired height for the capsule
Returns
True if it could change the height by any amount
Attempts to snap the capsule to the ground, if it penetrates the capsule.
Parameters
extraDistance
Extra amount to check under the character for the ground
Returns
True if the ground was found and the character snapped to it
Sets the global rotation of the character.
Parameters
rotation
The desired global rotation
Sets the global position of the character and tries to ground it.
Parameters
position
The desired global rotation
Moves the character sliding along collisions and checking for slopes and steps
Parameters
delta
The desired delta movement
void InjectAllCharacterController
( CapsuleCollider capsule )
void InjectCapsule
( CapsuleCollider capsule )
void InjectOptionalFeetAnchor
( Transform feetAnchor )
void InjectOptionalHeadAnchor
( Transform headAnchor )
Did you find this page helpful?
Thumbs up icon
Thumbs down icon