백지부터 시작하는 이세계 코딩 생활
MovePosition 본문
RigidBody . MovePosition (Vector3 position)
target 지점이 되는 position 으로 RigidBody를 이동시킨다.
transform.position 보다 RigidBody.MovePosition 이 더 부드럽게 움직이게 해준다. ( RigidBody의 Interpolate 옵션 때문 ) ( Ref. egloos.zum.com/metashower/v/9660975 )
private void Move()
{
rb.MovePosition(rb.position + moveVector * fMoveSpeed * Time.fixedDeltaTime);
}
Ref.
RigidBody.MovePosition()
1. 이동 출발 지점과 끝지점을 직선으로 연결한 경로를 매우 빠르게 이동한다.
2. 중간에 다른 rigidbody가 있을 경우 밀어내는 등의 물리처리를 한다.
1.Transform.position 을 이용해서 움직이는 경우 --> 아주 부득이한 상황에 순간이동을 하고싶을 때
2.RigidBody.position 을 이용해서 움직이는 경우 --> 순간이동을 하지만 성능도 좋게 하고싶을 때
3.RigidBody.MovePosition() 을 이용해서 움직이는 경우 --> 순간이동이 아닌 진짜 움직임을 묘사하고싶을 때
'백지부터 시작하는 이세계 유니티 생활 since 2020' 카테고리의 다른 글
eulerAngles (0) | 2020.11.18 |
---|---|
Mathf, Radian, Degree, Lerp (0) | 2020.11.18 |
Quaternion, LookRotation, Normalize (0) | 2020.11.18 |
Rotation, Rotate (0) | 2020.11.18 |
GetComponentInChildren, GetComponentsInChildren (0) | 2020.11.18 |
Comments