Files
vuong dinh hoang 10a6c47fba add channeling gfx
2026-05-19 09:45:16 +07:00

32 lines
753 B
C#

using UnityEngine;
public class AxisRotate : MonoBehaviour
{
[Header("Rotation Speed (degrees per second)")]
public float xSpeed = 0f;
public float ySpeed = 0f;
public float zSpeed = 0f;
[Header("Space")]
public Space rotationSpace = Space.Self;
private Quaternion initialRotation;
void OnEnable()
{
// Save original rotation when object becomes enabled
initialRotation = transform.rotation;
}
void OnDisable()
{
// Reset rotation when object becomes disabled
transform.rotation = initialRotation;
}
void Update()
{
Vector3 rotation = new Vector3(xSpeed, ySpeed, zSpeed);
transform.Rotate(rotation * Time.deltaTime, rotationSpace);
}
}