Version: 5.4
2D Physics Reference
콜라이더 2D

Rigidbody 2D

A Rigidbody 2D component places a GameObject under the control of the physics engine. Many concepts familiar from the standard Rigidbody component carry over to Rigidbody 2D; the differences are that in 2D, objects can only move in the XY plane and can only rotate on an axis perpendicular to that plane.

프로퍼티: 기능:
Use Auto Mass Check this box if you want the Rigidbody 2D to automatically detect and assume the GameObject’s mass from its Collider 2D.
Mass Mass of the Rigidbody 2D. This is greyed out if you have selected Use Auto Mass.
Linear Drag 포지션 움직임에 영향을 미치는 저항계수입니다.
Angular Drag 회전 움직임에 영향을 미치는 저항계수입니다.
Gravity Scale Degree to which the GameObject is affected by gravity.
Is Kinematic Check this if you want the Rigidbody 2D to be affected and moved by forces and collisions. See Kinematic Rigidbody 2D components, below, for more details.
Interpolate How the GameObject’s movement is interpolated between physics updates (useful when motion tends to be jerky).
        None 움직임에 스무딩을 적용하지 않습니다.
        Interpolate Movement is smoothed based on the GameObject’s positions in previous frames.
        Extrapolate 다음 프레임에서의 게임 오브젝트 포지션을 추정해 움직임을 스무딩합니다.
Sleeping Mode How the object “sleeps” to save processor time when it is at rest.
        Never Sleep Sleeping is disabled. This option should be avoided where possible, as it can be very demanding on resources at run time.
        Start Awake 처음에 게임 오브젝트가 깨어 있습니다.
        Start Asleep 처음에 게임 오브젝트가 수면 상태이지만 충돌하면 깨어납니다.
Collision Detection How collisions with other objects are detected.
        Discrete A collision is registered only if the GameObject’s Collider 2D is in contact with another during a physics update.
        Continuous A collision is registered if the GameObject’s Collider 2D appears to have contacted another between updates.
Constraints Restrictions on the Rigidbody 2D’s motion.
        Freeze Position Stops the Rigidbody 2D moving in the world’s x and y axes selectively.
        Freeze Rotation 월드의 z 축을 중심으로 회전하는 리지드바디 2D를 선택적으로 정지시킵니다.

How a Rigidbody 2D works

일반적으로 Unity 에디터의 Transform 컴포넌트는 게임 오브젝트 및 자식 게임 오브젝트가 씬 내에 배치, 회전 및 스케일되는 방식을 정의합니다. 컴포넌트가 변경되면 다른 컴포넌트를 업데이트하며, 이에 따라 컴포넌트가 렌더링되는 포지션이나 콜라이더가 배치되는 포지션 등이 업데이트될 수 있습니다. 2D 물리 엔진은 콜라이더를 움직이고 서로 상호작용하도록 할 수 있으며, 따라서 물리 엔진에서 콜라이더의 이러한 움직임을 Transform 컴포넌트에 다시 전달하기 위한 메서드가 필요합니다. 이러한 움직임 및 콜라이더와의 연결이 Rigidbody 2D 컴포넌트의 용도입니다.

Rigidbody 2D 컴포넌트는 트랜스폼을 오버라이드하고 리지드바디 2D에 의해 정의된 포지션/회전으로 업데이트합니다. Unity에서는 모든 컴포넌트의 모든 프로퍼티를 노출하므로 Transform 컴포넌트를 직접 수정하여 리지드바디 2D를 오버라이드할 수도 있지만, 그렇게 할 경우 게임 오브젝트가 서로 통과하는 것과 같은 문제 및 예측할 수 없는 움직임이 발생합니다.

같은 게임 오브젝트나 자식 게임 오브젝트에 추가되는 모든 Collider 2D 컴포넌트는 해당 리지드바디 2D에 암시적으로 연결됩니다. 콜라이더 2D가 리지드바디 2D에 연결되면 같이 움직입니다. 콜라이더 2D는 트랜스폼이나 콜라이더 오프셋을 사용하여 직접 이동시키면 안 됩니다. 대신 리지드바디 2D를 움직여야 합니다. 이에 따라 성능이 개선되고 정확한 충돌 검사가 가능합니다. 같은 리지드바디 2D에 연결된 콜라이더 2D는 서로 충돌하지 않습니다. 즉, 리지드바디 2D와 동기화되어 모두 함께 움직이고 회전하는 단일 복합 콜라이더와 같이 효과적으로 작동하는 콜라이더 세트를 만들 수 있습니다.

씬을 디자인할 때 원하는 대로 디폴트 리지드바디 2D를 사용하고 콜라이더를 연결할 수 있습니다. 이 콜라이더를 사용하면 다른 리지드바디 2D에 연결된 다른 콜라이더들과 서로 충돌할 수 있습니다.

Tip

Adding a Rigidbody 2D allows a sprite to move in a physically convincing way by applying forces from the scripting API. When the appropriate collider component is also attached to the sprite GameObject, it is affected by collisions with other moving GameObjects. Using physics simplifies many common gameplay mechanics and allows for realistic behavior with minimal coding.

Kinematic Rigidbody 2D components

The Is Kinematic setting switches off the physical behaviour of the Rigidbody 2D so that it will not react to gravity and collisions. This is typically used to keep a GameObject under non-physical script control most of the time, but then switch to physics in a particular situation. For example, a player might normally move by walking (better handled without physics) but then get catapulted into the air by an explosion or strike (better handled with physics). Physics can be used to create the catapulting effect if you switch off Is Kinematic just before applying a large force to the GameObject.

2D Physics Reference
콜라이더 2D