代码之家  ›  专栏  ›  技术社区  ›  ThePurpleArcher

统一if语句中四元数和eulerAngles的问题

  •  1
  • ThePurpleArcher  · 技术社区  · 6 年前

    我一直在寻找答案并测试不同的东西,但它不起作用,所以我在这里问它。我得到的错误是

    “无法修改“Quaternion.eulerAngles”的返回值,因为它不是变量”

    代码如下:

    void FixedUpdate ()
    
    {
        Quaternion rot = transform.rotation;
        if (rot.eulerAngles.y =< 91)))
        {
            rb.AddTorque(transform.up * rotationStopper);
        }
    }
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Daxtron2 programmergirl90    6 年前
    if (rot.eulerAngles.y =< 91)))
    

    应该是

    if (rot.eulerAngles.y <= 91)))
    

    最上面的一个尝试分配给y变量,但失败了,因为它不理解“<91”是什么。