pangcola avatar

Pivot 기준으로 회전시키기 (Rotation about a Pivot)

pangcola

Published: 08 Feb 2019 › Updated: 08 Feb 2019Pivot 기준으로 회전시키기 (Rotation about a Pivot)

Pivot 기준으로 회전시키기 (Rotation about a Pivot)

public static Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 euler)
{
        return (Quaternion.Euler(euler) * (point - pivot)) + pivot;
}

회전의 기준이 오브젝트 중앙이라면 간단하게 회전시킬 수 있지만,
기준이 중앙에서 벗어난다면 회전 시 위치 이동과 회전을 동시에 해줘야
오브젝트가 회전하는 것처럼 보입니다.

point : 오브젝트의 현재 위치
pivot : 회전의 기준이 되는 위치
euler : x, y, z 축 회전각(Degree)

nimiq.png

Leave Pivot 기준으로 회전시키기 (Rotation about a Pivot) to:

Written by

i love coke.

Read more #kr posts


Best Posts From pangcola

We have not curated any of pangcola's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From pangcola