[英]How to make to rotation relative to each other? 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, 0, rotate);
while (rotate > 359)
rotate = 0;
}
}
問題是物體(4 把鋸)在綠線上移動,但它們應該沿着藍線(彼此),它們應該繞藍線轉動。
只需使用 .localRotation 而不是 .rotation,它應該會有所幫助
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.