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\$

1 Answer 1

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

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .