【发布时间】:2020-09-12 22:01:27
【问题描述】:
这个脚本有问题
using System.Collections.Generic;
using UnityEngine;
public class ObrotPily : MonoBehaviour
{
private float rotate;
public float rotateStrong;
void Update()
{
rotate += rotateStrong;
transform.rotation = Quaternion.Euler(0, 0, rotate);
while (rotate > 359)
rotate = 0;
}
}
问题是物体(4 个锯子)在绿线上移动,但它们应该跟随蓝线(彼此),它们应该 绕蓝线转。
【问题讨论】:
-
你的层次结构是什么样的?
-
附注:尝试在代码中用英文写出名称。理解名称对于理解代码本身非常有帮助。这段代码很短,所以没问题,但在较长的代码中,很多人甚至不会费心用原生命名来阅读它,因为它会增加理解它所需的工作量。
-
link我将代码重写为英文。