0
저는 게임을 화합으로 만드는 법을 배우고 있습니다. 나는 위로부터 아래로 움직이는 바위를 가지고 있으며, 그것을 중심에서 회전시키지 못한다. 솔루션을 찾고 있지만 찾지 못했습니다. 어떤 아이디어?유니티에서 내 이미 움직이는 물체를 회전 시키십시오.
IEnumerator Move(Vector3 target)
{
while (Mathf.Abs((target - transform.localPosition).y) > 0.20f)
{
Vector3 direction = target.y == topPosition.y ? Vector3.up : Vector3.down;
transform.localPosition += direction * Time.deltaTime * speed;
yield return null;
}
yield return new WaitForSeconds (0.5f);
Vector3 newTarget = target.y == topPosition.y ? bottomPosition : topPosition;
StartCoroutine (Move (newTarget));
}
'transform.Rotate'를 호출 해 보았습니까? 또는'transform.localEulerAngles'에 할당하는 것도 괜찮을 수 있습니다. – rutter