补充示例

This commit is contained in:
2026-07-25 15:42:00 +08:00
parent d4ae58193d
commit 07bb4c7c9c
54 changed files with 569 additions and 328 deletions
+7 -7
View File
@@ -2,31 +2,31 @@ using UnityEngine;
namespace Kirurobo {
/// <summary>
/// 使附加的对象以恒定速度进行偏航旋转
/// アタッチしたオブジェクトを一定速度でヨー回転させる
/// </summary>
public class AutoRotator : MonoBehaviour {
/// <summary>
/// 旋转速度 [度/秒]
/// 回転速度 [deg/s]
/// </summary>
public float angularVelocity = 90f;
/// <summary>
/// 旋转轴(偏航旋转,方向向上)
/// 回転軸(ヨー回転のため上向き)
/// </summary>
Vector3 rotationAxis = Vector3.up;
/// <summary>
/// 初始姿态
/// 初期姿勢
/// </summary>
Quaternion initialLocalRotation;
// 用于初始化
// Use this for initialization
void Start () {
// 记录初始姿态
// 初期姿勢を記憶
initialLocalRotation = transform.localRotation;
}
// 每帧调用 Update
// Update is called once per frame
void Update () {
var rotation = Quaternion.Euler(0f, Time.time * angularVelocity, 0f);
transform.localRotation = initialLocalRotation * rotation;