如何使彼此相对旋转? Unity 2D

问题描述

我对此脚本有疑问

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,rotate);

        while (rotate > 359)
            rotate = 0;
    }
}

问题在于,对象(4个锯)在绿线上移动,但它们应沿蓝线(彼此移动),它们应该 转蓝线。

Here's a problem

解决方法

只需使用.localRotation而不是.rotation,它应该有帮助