게임엔진/Unity
[Unity] 오브젝트를 움직이는 두 방법과 차이
ShovelingLife
2022. 5. 31. 10:05
총 두가지의 방법으로 오브젝트를 움직일 수가 있다
1) Transform.Translate(방향 예) Vector3.left * 속도 * Time.DeltaTime);
2)
Vector3 new_pos=오브젝트.Transform.position 또는 localPosition;
new_pos.x += (속도 * Time.deltaTime);
오브젝트.Transform.position 또는 localPosition = new_pos;
이 두가지의 가장 큰 차이점은 회전했을 때 바라보고 있는 방향으로 가냐 안가냐이다.