我无法让我的游戏对象在两个角度之间平滑旋转

I can't get my GameObject to smoothly rotate between two angles

所以我正在使用这个代码:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class wands : MonoBehaviour
{
    public Transform WandPos;
    void Update()
    {
        WandPos.rotation = Quaternion.Lerp(new Quaternion(0,0,1,0), new Quaternion(0,0,0.866025448f,0.49999994f),Time.time * .5f);
    }
}

出于某种原因,它甚至在 GameObject 旋转之前就开始旋转,所以当它实例化时,GameObject 会捕捉到它在场景开始时实例化时的位置。我可能只是遗漏了一些明显的东西,但我似乎也无法在网上的任何地方找到我的解决方案。

此外,如果有比我编写的代码更简单的方法,请告诉我。

好吧 Time.time 是以秒为单位的时间 自您启动应用程序以来

听起来你更想跟踪自实例化对象以来的时间,例如喜欢

private float time;

void Update ()
{
    time += Time.deltaTime * 0.5f;
    WandPos.rotation = Quaternion.Lerp(new Quaternion(0,0,1,0), new Quaternion(0,0,0.866025448f,0.49999994f), time);
}