123456789101112131415161718 |
- using UnityEngine;
- public class ContinuousRotation : MonoBehaviour
- {
- // 控制旋转的速度(每秒旋转的角度)
- public float rotationSpeedX = 0f; // X轴旋转速度
- public float rotationSpeedY = 0f; // Y轴旋转速度
- public float rotationSpeedZ = 0f; // Z轴旋转速度
- void Update()
- {
- // 按照设定的速度围绕指定轴旋转
- transform.Rotate(rotationSpeedX * Time.deltaTime,
- rotationSpeedY * Time.deltaTime,
- rotationSpeedZ * Time.deltaTime);
- }
- }
|