using System.Collections; using System.Collections.Generic; using UnityEngine; public class SpinVert : MonoBehaviour { [Header("Spin on axis")] [SerializeField] public bool X = false; [SerializeField] public bool Y = false; [SerializeField] public bool Z = false; [Header("Controller")] [SerializeField] public bool Spin = false; [SerializeField] private float Speed = 100f; // Update is called once per frame void Update() { if (Spin) { if (X) { transform.Rotate(Speed * Time.deltaTime, 0f, 0f, Space.Self); } if (Y) { transform.Rotate(0f, Speed * Time.deltaTime, 0f, Space.Self); } if (Z) { transform.Rotate(0f, 0f, Speed * Time.deltaTime, Space.Self); } } } public void StartSpinning() { Spin = true; } }