백지부터 시작하는 이세계 유니티 생활 since 2020
Collider
조아덕
2020. 12. 25. 22:53
Collider
모든 충돌체(collider)의 기본 클래스를 나타낸다.
Rigidbody 컴포넌트가 할당되어 있을 시,
해당 오브젝트가 다른 오브젝트들과 물리적인 상호작용을 하지 않기를 원한다면
Rigidbody 컴포넌트를 kinematic으로 설정할 수 있다.
Variables
attachedRigidbody | 콜라이더가 연결되어 있는 Rigidbody입니다. |
bounds | 월드 좌표공간(world space)에서의 충돌체(collider)의 바운딩 크기(bounding volume)를 나타냅니다. |
contactOffset | Contact offset value of this collider. |
enabled | 활성화된 충돌체(collider)는 다른 충돌체와 충돌하게 되며, 비활성화 시 충돌하지 않습니다. |
isTrigger | 충돌체(collider)가 첨부된 리지드바디를 나타냅니다. |
material | 충돌체(collider)에 의해 사용되는 재질(material)을 나타냅니다. |
sharedMaterial | 충돌체(collider)의 공유된 물리 재질(shared physic material)을 나타냅니다. |
Public Functions
ClosestPointOnBounds | 설정한 지점에서 가장 가까운 Bounds 오브젝트의 포인트입니다. |
Raycast | 이 콜라이더만을 판단하는 Ray를 보냅니다. 다른 콜라이더는 무시됩니다. |
Messages
OnCollisionEnter | OnCollisionEnter는 이collider/rigidbody에 다른 collider/rigidbody가 닿을 때 호출됩니다. |
OnCollisionExit | OnCollisionExit는 이 collider/rigidbody가 다른 collider/rigidbody와 접촉을 중단했을 때 호출됩니다. |
OnCollisionStay | OnCollisionStay는 rigidbody/collider가 다른 rigidbody/collider에 접해 있는 동안 매 프레임 1번만 호출됩니다. |
OnTriggerEnter | Collider가 다른 트리거 이벤트에 침입했을 때 OnTriggerEnter가 호출됩니다. |
OnTriggerExit | OnTriggerExit는 Collider가 /other/의 트리거에 닿는 것을 중지했을 때 호출됩니다. |
OnTriggerStay | OnTriggerStay는 트리거가 다른 Collider에 계속 닿아 있는 동안 "거의" 매 프레임 호출됩니다. |
Inherited members
Variables
gameObject | 현재의 컴포넌트가 첨부된 게임 오브젝트를 나타냅니다. 컴포넌트(component)는 항상 게임 오브젝트에 첨부되어 있다. |
tag | 현재 게임 오브젝트의 태그를 나타냅니다. |
transform | 현재 GameObject에 첨부된 Transform를 나타냅니다. (첨부되지 않은 경우에 null) |
hideFlags | 오브젝트가 숨겨져있는 상태인지, 씬에 저장된 상태인지, 또는 사용자에 의해서 수정가능한 상태인지를 확인합니다. |
name | 오브젝트의 이름을 나타냅니다. |
Public Functions
BroadcastMessage | 게임오브젝트의 모든 MonoBehaviour나 Children 들에 대해 /methodName/으로 이름지어진 메서드를 호출 합니다. |
CompareTag | 게임 오브젝트에 tag 태그가 태깅되었는가? |
GetComponent | 제네릭(Generic) 버젼을 나타낸다. 더 자세한 정보는 Generic Functions페이지에서 확인. |
GetComponentInChildren | Returns the component of Type type in the GameObject or any of its children using depth first search. |
GetComponentInParent | Returns the component of Type type in the GameObject or any of its parents. |
GetComponents | 제네릭(Generic) 버젼을 나타낸다. 더 자세한 정보는 Generic Functions페이지에서 확인. |
GetComponentsInChildren | Returns all components of Type type in the GameObject or any of its children. |
GetComponentsInParent | Returns all components of Type type in the GameObject or any of its parents. |
SendMessage | 게임오브젝트의 모든 MonoBehaviour들에 대해 /methodName/으로 이름지어진 메서드를 호출 합니다. |
SendMessageUpwards | 게임오브젝트와 behaviour의 acestor의 모든 MonoBehaviour들에 대해 /methodName/으로 이름지어진 메서드를 호출 합니다. |
GetInstanceID | 오브젝트의 인스턴스 ID를 반환합니다. |
ToString | 게임 오브젝트의 이름을 반환합니다. |
Static Functions
Destroy | 게임오브젝트, 컴포넌트나 애셋을 삭제합니다. |
DestroyImmediate | obj 오브젝트를 즉시 파괴합니다. Destroy를 사용하는 것을 추천합니다. |
DontDestroyOnLoad | 새로운 Scene이 로드될때 자동으로 파괴되지 않는 target 오브젝트를 만듭니다. |
FindObjectOfType | 첫번째 활성화한 로드된 type 타입의 오브젝트를 반환합니다. |
FindObjectsOfType | 모든 활성화한 로드된 type 타입의 오브젝트 리스트를 반환합니다. |
Instantiate | 오브젝트의 인스턴스 ID를 반환합니다. |
Ref.
docs.unity3d.com/kr/530/ScriptReference/Collider.html
Unity - 스크립팅 API: Collider
See Also: BoxCollider, SphereCollider, CapsuleCollider, MeshCollider, PhysicMaterial, Rigidbody. 콜라이더를 가진 오브젝트가 게임플레이 중에 움직여질 경우, 해당 오브젝트에는 Rigidbody 컴포넌트를 붙여야 합니다. 만
docs.unity3d.com