CharacterController

class in UnityEngine

/

다음으로부터 상속:Collider

매뉴얼로 전환

설명

A CharacterController allows you to easily do movement constrained by collisions without having to deal with a rigidbody.

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.

See Also: Character Controller component and Character animation examples

변수

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).

Public 함수

MoveA more complex move function taking absolute movement deltas.
SimpleMoveMoves the character with speed.

메시지

OnControllerColliderHitOnControllerColliderHit is called when the controller hits a collider while performing a Move.

상속된 멤버

변수

attachedRigidbodyThe rigidbody the collider is attached to.
boundsThe world space bounding volume of the collider (Read Only).
contactOffsetContact offset value of this collider.
enabledEnabled Colliders will collide with other Colliders, disabled Colliders won't.
isTriggerIs the collider a trigger?
materialThe material used by the collider.
sharedMaterialThe shared physic material of this collider.
gameObjectThe game object this component is attached to. A component is always attached to a game object.
tagThe tag of this game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public 함수

ClosestPointReturns a point on the collider that is closest to a given location.
ClosestPointOnBoundsThe closest point to the bounding box of the attached collider.
RaycastCasts a Ray that ignores all Colliders except this one.
BroadcastMessageCalls the method named methodName on every MonoBehaviour in this game object or any of its children.
CompareTagIs this game object tagged with tag ?
GetComponentReturns the component of Type type if the game object has one attached, null if it doesn't.
GetComponentInChildrenReturns the component of Type type in the GameObject or any of its children using depth first search.
GetComponentInParentReturns the component of Type type in the GameObject or any of its parents.
GetComponentsReturns all components of Type type in the GameObject.
GetComponentsInChildrenReturns all components of Type type in the GameObject or any of its children.
GetComponentsInParentReturns all components of Type type in the GameObject or any of its parents.
SendMessageCalls the method named methodName on every MonoBehaviour in this game object.
SendMessageUpwardsCalls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.
GetInstanceIDReturns the instance id of the object.
ToStringReturns the name of the GameObject.

정적 함수

DestroyRemoves a gameobject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeReturns a list of all active loaded objects of Type type.
InstantiateClones the object original and returns the clone.

연산자

boolDoes the object exist?
operator !=Compares if two objects refer to a different object.
operator ==Compares two object references to see if they refer to the same object.

메시지

OnCollisionEnterOnCollisionEnter is called when this collider/rigidbody has begun touching another rigidbody/collider.
OnCollisionExitOnCollisionExit is called when this collider/rigidbody has stopped touching another rigidbody/collider.
OnCollisionStayOnCollisionStay is called once per frame for every collider/rigidbody that is touching rigidbody/collider.
OnTriggerEnter OnTriggerEnter is called when the Collider other enters the trigger.
OnTriggerExitOnTriggerExit is called when the Collider other has stopped touching the trigger.
OnTriggerStayOnTriggerStay is called almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer so it won't necessarily run every frame.