1
\$\begingroup\$

When I try to run my game in unity, it comes up with the error:

No appropriate version of 'UnityEngine.Quaternion.Euler' for the argument list '(UnityEngine.Quaternion)' was found.

When using the update code in (written in javascript):

transform.Rotate(Quaternion.Euler(transform.rotation * Quaternion.Inverse(GameObject.Find("Main Camera").transform.rotation)));

Any help would be appreciated.

\$\endgroup\$
0
\$\begingroup\$

Quaternion.Euler creates a Quaternion from three euler angles either by parameter list of floats or a Vector3 of the angles, not from a Quaternion (see docs):

public static Quaternion Euler(float x, float y, float z);

OR

public static Quaternion Euler(Vector3 euler);

Did you mean to write:

transform.Rotate((transform.rotation * Quaternion.Inverse(GameObject.Find("Main Camera").transform.rotation)).eulerAngles);

eulerAngles

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.