123456789101112131415161718192021222324 |
- using Unity.Mathematics;
- using UnityEngine;
- /* 用来控制飞盘自动旋转的功能
- * 这个脚本可以附加到飞盘对象上,使其在游戏中自动旋转
- */
- public class FrisbeeRotateController : MonoBehaviour
- {
- public float rotationSpeed = 0f; // 旋转速度,单位为度/秒
- // Start is called once before the first execution of Update after the MonoBehaviour is created
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- // 计算每帧旋转的角度
- float rotationAmount = rotationSpeed * Time.deltaTime;
- // 应用旋转
- transform.Rotate(0, 0, rotationAmount, Space.Self);
- }
- }
|