SCharacterController
Index
Functions Index
SVector ClosestPointOnBounds (SVector position)
SVector ClosestPoint (SVector position)
bool SimpleMove (SVector speed)
int Move (SVector motion)
Properties Index
SVector Center get
set
bool DetectCollisions get
set
bool EnableOverlapRecovery get
set
float Height get
set
float MinMoveDistance get
set
float Radius get
set
float SkinWidth get
set
float SlopeLimit get
set
float StepOffset get
set
SVector Velocity get
Functions
ClosestPointOnBounds
SVector ClosestPointOnBounds (SVector position)
The closest point to the bounding box of the attached collider. This can be used to calculate hit points when applying explosion damage.
ClosestPoint
SVector ClosestPoint (SVector position)
The point on the collider that is closest to the specified location.
SimpleMove
bool SimpleMove (SVector speed)
Moves the character with speed. Velocity along the y-axis is ignored. Speed is in units/s. Gravity is automatically applied.
Returns if the character is grounded.
It is recommended that you make only one call to Move or SimpleMove per frame.
Move
int Move (SVector motion)
Supplies the movement of a SGameObject with an attached SCharacterController component.
The SCharacterController.Move motion moves the SGameObject in the given direction. The given direction requires absolute movement delta values. A collision constrains the Move from taking place.
Returns an int indicating the direction of a collision: None (0), Sides (1), Above (2), and Below (3). SCharacterController.Move does not use gravity.
Properties
Center
SVector Center get
set
Returns Center Vector value of the Character Controller.
DetectCollisions
bool DetectCollisions get
set
Determines whether other rigidbodies or character controllers collide with this character controller (by default this is always enabled).
This method does not affect collisions detected during the character controller's movement but rather decides whether an incoming collider will be blocked by the controller's collider. For example, a box collider in the Scene will block the movement of the controller, but the box may still fall through the controller if detectCollisions is false. This property is useful to disable the character controller temporarily. For example, you might want to mount a character into a car and disable collision detection until it exits the car again.
EnableOverlapRecovery
bool EnableOverlapRecovery get
set
Enables or disables overlap recovery. Enables or disables overlap recovery. Used to depenetrate character controllers from static objects when an overlap is detected.
Overlap recovery can be used to depenetrate character controllers (CCTs) from static objects when an overlap is detected. This can happen in three main cases:
- when the CCT is directly spawned or teleported in another object
- when the CCT algorithm fails due to limited FPU accuracy
- when the "up vector" is modified, making the rotated CCT shape overlap surrounding objects
When activated, the CCT module will automatically try to resolve the penetration, and move the CCT to a safe place where it does
not overlap other objects anymore. This only concerns static objects, dynamic objects are ignored by overlap recovery.
When overlap recovery is not activated, it is possible for the CCTs to go through static objects. By default, overlap recovery is enabled.
Overlap recovery currently works with all geometries except heightfields.
Height
float Height get
set
The height of the character's capsule.
MinMoveDistance
float MinMoveDistance get
set
Gets or sets the minimum move distance of the character controller.
Radius
float Radius get
set
The radius of the character's capsule.
SkinWidth
float SkinWidth get
set
The character's collision skin width.
SlopeLimit
float SlopeLimit get
set
The character controllers slope limit in degrees.
StepOffset
float StepOffset get
set
The character controllers step offset in meters.
Velocity
SVector Velocity get
The current relative velocity of the Character.
GameObject
SGameObject GameObject get
Returns a reference to the GameObject of this component.
Last updated