Skip to content

CharacterController

extends Collider

The CharacterController class is used to control the movement of characters or other objects in a 3D scene.

You can obtain a CharacterController component object in the following way:

javascript
let obj = new GameObject();
let com = obj.AddComponent<CharacterController>(CharacterController);

成员变量

CharacterController.velocity : Vector3
The current speed of the character controller.
CharacterController.isGrounded : boolean
Determines whether the character controller is in contact with the ground.
CharacterController.collisionFlags : CollisionFlags
Get the collision state of the object in the current frame.
CharacterController.center : Vector3
This value represents the center position of the character represented by the character controller.
CharacterController.radius : number
The radius of the character controller.
CharacterController.height : number
The height of the character controller.
CharacterController.slopeLimit : number
The maximum angle of the slope that the character controller can climb.
CharacterController.stepOffset : number
The maximum step height allowed by the character controller.
CharacterController.skinWidth : number
The gap size between the character controller and other colliders.
CharacterController.minMoveDistance : number
The minimum movement distance for the character controller.
CharacterController.detectCollisions : boolean
Whether to enable collision detection for the character controller.
CharacterController.minPositionIters : number
The number of iterations the engine performs when solving for minimum position.

成员方法

CharacterController.Move ( value : Vector3 ) : CollisionFlags
Move the character controller and perform collision detection.
CharacterController.SimpleMove ( value : Vector3 ) : boolean
Performs a simple movement operation.