PC-20230316NUNE\Administrator 2b467e56ad no message
2024-02-20 18:39:12 +08:00

28 lines
702 B
C#

using UnityEngine;
namespace HPJ.Examples
{
/// <summary>
/// An example script that rotates a object over time
/// </summary>
public class Rotate : MonoBehaviour
{
public float RotationSpeed = 5;
public Space RotationSpace = Space.World;
public Vector3 Rotation = new Vector3();
private Vector3 RotationVector = new Vector3();
private void Awake()
{
Rotation = Rotation.normalized;
RotationVector = Rotation * RotationSpeed;
}
// Update is called once per frame
void Update()
{
transform.Rotate(RotationVector * Time.deltaTime, RotationSpace);
}
}
}