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.

Protected Fields

_groundHit : RaycastHit
Signature
RaycastHit Oculus.Interaction.Locomotion.CharacterController._groundHit
_isGrounded : bool
Signature
bool Oculus.Interaction.Locomotion.CharacterController._isGrounded
_started : bool
Signature
bool Oculus.Interaction.Locomotion.CharacterController._started

Fields

GroundHit : RaycastHit
Current hit of the ground against the capsule
Signature
RaycastHit Oculus.Interaction.Locomotion.CharacterController.GroundHit
Height : float
Actual height of the capsule
Signature
float Oculus.Interaction.Locomotion.CharacterController.Height
IsGrounded : bool
Whether the capsule is touching the ground
Signature
bool Oculus.Interaction.Locomotion.CharacterController.IsGrounded
Pose : Pose
Current Pose of the capsule
Signature
Pose Oculus.Interaction.Locomotion.CharacterController.Pose
Radius : float
Radius of the capsule
Signature
float Oculus.Interaction.Locomotion.CharacterController.Radius

Properties

LayerMask : LayerMask
[Get][Set]
Signature
LayerMask Oculus.Interaction.Locomotion.CharacterController.LayerMask
MaxReboundSteps : int
[Get][Set]
Signature
int Oculus.Interaction.Locomotion.CharacterController.MaxReboundSteps
MaxSlopeAngle : float
[Get][Set]
Signature
float Oculus.Interaction.Locomotion.CharacterController.MaxSlopeAngle
MaxStep : float
[Get][Set]
Signature
float Oculus.Interaction.Locomotion.CharacterController.MaxStep
SkinWidth : float
[Get][Set]
Signature
float Oculus.Interaction.Locomotion.CharacterController.SkinWidth

Protected Methods

OnEnable ()
Signature
virtual void Oculus.Interaction.Locomotion.CharacterController.OnEnable()
Returns
void
Start ()
Signature
virtual void Oculus.Interaction.Locomotion.CharacterController.Start()
Returns
void

Methods

InjectAllCharacterController ( capsule )
Signature
void Oculus.Interaction.Locomotion.CharacterController.InjectAllCharacterController(CapsuleCollider capsule)
Parameters
capsule: CapsuleCollider
Returns
void
InjectCapsule ( capsule )
Signature
void Oculus.Interaction.Locomotion.CharacterController.InjectCapsule(CapsuleCollider capsule)
Parameters
capsule: CapsuleCollider
Returns
void
InjectOptionalFeetAnchor ( feetAnchor )
Signature
void Oculus.Interaction.Locomotion.CharacterController.InjectOptionalFeetAnchor(Transform feetAnchor)
Parameters
feetAnchor: Transform
Returns
void
InjectOptionalHeadAnchor ( headAnchor )
Signature
void Oculus.Interaction.Locomotion.CharacterController.InjectOptionalHeadAnchor(Transform headAnchor)
Parameters
headAnchor: Transform
Returns
void
Move ( delta )
Moves the character sliding along collisions and checking for slopes and steps
Signature
void Oculus.Interaction.Locomotion.CharacterController.Move(Vector3 delta)
Parameters
delta: Vector3  The desired delta movement
Returns
void
SetPose ( pose )
Sets the global pose of the character
Signature
void Oculus.Interaction.Locomotion.CharacterController.SetPose(in Pose pose)
Parameters
pose: in Pose  The desired global pose
Returns
void
SetPosition ( position )
Sets the global position of the character.
Signature
void Oculus.Interaction.Locomotion.CharacterController.SetPosition(in Vector3 position)
Parameters
position: in Vector3  The desired global position
Returns
void
SetRotation ( rotation )
Sets the global rotation of the character.
Signature
void Oculus.Interaction.Locomotion.CharacterController.SetRotation(in Quaternion rotation)
Parameters
rotation: in Quaternion  The desired global rotation
Returns
void
TryGround ( extraDistance )
Attempts to snap the capsule to the ground, if it penetrates the capsule.
Signature
bool Oculus.Interaction.Locomotion.CharacterController.TryGround(float extraDistance=0f)
Parameters
extraDistance: float  Extra amount to check under the character for the ground
Returns
bool  True if the ground was found and the character snapped to it
TrySetHeight ( desiredHeight )
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.
Signature
bool Oculus.Interaction.Locomotion.CharacterController.TrySetHeight(float desiredHeight)
Parameters
desiredHeight: float  The desired height for the capsule
Returns
bool  True if it could change the height by any amount