기술 자료

Unity Engine


User Manual

Script Reference

Unity Engine


Capsule collider component reference

Reference page for the Capsule collider component.
읽는 시간 2분최근 업데이트: 25일 전

The Capsule collider is a built-in 3D capsule-shaped collider made of two half-spheres joined together by a cylinder. It is useful for in-application items that have a cylindrical shape, or as a collider for player and non-player characters in a scene.
Because Capsule colliders have no corners, they are also useful to soften the collision area of sharp corners and edges in level geometry, so that players move more smoothly.
The Capsule collider has relatively low resource requirements.

Property

Description

Edit ColliderEnable the Edit Collider button to display the collider’s contact points in the Scene view. You can click and drag these contact points to modify the size and shape of the collider. Alternatively, use the Center, Radius, and Height properties.
Is TriggerEnable Is Trigger to use the collider as a trigger for events. When Is Trigger is enabled, other colliders pass through this collider, and trigger the messages
OnTriggerEnter
,
OnTriggerStay
, and
OnTriggerExit
.
Provides ContactsEnable Provides Contacts to generate contact information for this collider at all times. Usually, a collider only generates contact data if there is something to send it to; in this case, the messages
OnCollisionEnter
,
OnCollisionStay
, or
OnCollisionExit
. When Provides Contacts is enabled, the collider generates contact data for the physics system at all times. Contact generation is resource-intensive, so Provides Contacts is disabled by default.
MaterialAdd the Physic Material component that determines the friction and bounciness of this collider.
CenterDefine the position of the collider on each axis in the GameObject's local space. By default, this is set to (0, 0, 0).
RadiusDefine the radius of the collider from its center. You can adjust the Radius independently of the Height. By default, this is set to 0.5.
HeightDefine the total height of the collider in Unity units. You can adjust the Height independently of the Radius. By default, this is set to 2.
DirectionDefine the axis of the capsule's lengthwise orientation in the object's local space.

Layer overrides

The Layer Overrides section provides properties that allow you to override the project-wide Layer-based collision detection settings for this collider.

Property

Description

Layer Override PriorityDefine the priority of this collider override. When two colliders have conflicting overrides, the settings of the collider with the higher value priority are taken.
For example, if a collider with a Layer Override Priority of 1 collides with a Collider with a Layer Override Priority of 2, the physics system uses the settings for the Collider with the Layer Override Priority of 2.
Include LayersChoose which Layers to include in collisions with this collider.
Exclude LayersChoose which Layers to exclude in collisions with this collider.