특정 오브젝트 주위를 회전 시키기
Transform.RotateAround(Vector3 point, Vector3 axis, float angle)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateCloud : MonoBehaviour
{
public GameObject Planet;
public float speed = 5.0f;
void Update()
{
orbitAround();
}
void orbitAround()
{
transform.RotateAround(Planet.transform.position, Vector3.down, speed * Time.deltaTime);
}
}
스스로 빙글~빙글~ 돌기
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotatingSelf : MonoBehaviour
{
private float speed = 10f;
void Update()
{
Rotating();
}
void Rotating()
{
transform.Rotate(new Vector3(0, 0, speed * Time.deltaTime));
}
}