반응형
- 공전
public class MoonRevolution : MonoBehaviour
{
public Transform target;
[Range(0, 100)]
public float rotateSpeed = 10f;
private void Update()
{
transform.RotateAround(target.transform.position, new Vector3(0, 1, 0), rotateSpeed * Time.deltaTime);
}
}
- 자전
public class EarthRotation : MonoBehaviour
{
[Range(0, 100)]
public float speed = 25f;
private void Update()
{
transform.Rotate(new Vector3(0, 1, 0) * speed * Time.deltaTime);
}
}
참고할만한 글
반응형