using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlanetSpin : MonoBehaviour { [Header("Параметри обертання")] [Header("Нахил осі")] [Range(0f, 100f)] [SerializeField] private float axialTilt = 0.5f; [Header("Швидкість обертання навколо осі")] [Range(0f, 180f)] [SerializeField] private float rotationSpeed = 10f; public float RotationSpeed => rotationSpeed; void Start() { transform.localRotation = Quaternion.Euler(0f, 0f, axialTilt); } public void SetRotationSpeed(float value) { rotationSpeed = value; } void Update() { float rotationThisFrame = rotationSpeed * Time.deltaTime; transform.Rotate(Vector3.up, rotationThisFrame, Space.Self); } }