quality-control/Assets/Scripts/ConstantRotation.cs

17 lines
404 B
C#
Raw Normal View History

2024-08-18 15:48:35 +00:00
using UnityEngine;
public class ConstantRotation: MonoBehaviour
{
public Vector3 Axis = Vector3.up;
public float RotationRate = 1f;
public void Update()
{
var rotation = transform.rotation;
var delta = Quaternion.AngleAxis(RotationRate * Time.deltaTime, Axis);
transform.SetPositionAndRotation(transform.position, rotation * delta);
}
}