Quaternion not showing W, not allowing negative values in Inspector?

Hi all!

I am trying to implement one of Meta’s Interaction examples and this script has a list of Quaternions that define Rotation Directions for a virtual cube. In Meta’s example scene the Rotation directions show up as a list of XYZW values and can be negative:

However, in my scene, using the same Unity version (2022.3.13f1) the Quaternions are only shown as XYZ values and don’t allow for negative values:

Both scenes use the same script. In both scenes the Rotation Directions are defined as Quaternion[ ]:

Does anyone know why my Quaternions are shown differently? Is there a way to set them as XYZW values?
Much thanks in advance!
IF

These are “nice looking” euler angles values, not the actual internals of the Quaternion that matter.

The internal .x,.y,.z,.w values are NOT for you to use. (EDIT: unless, as @halley1 points out below, it’s what you need and what your data expects)

Here’s some more reading:

All about Euler angles and rotations, by StarManta:

https://starmanta.gitbooks.io/unitytipsredux/content/second-question.html

Quaternion dumper if you insist on peeking inside the ugly parts:

https://discussions.unity.com/t/920939/13

1 Like

In code, you can do whatever you want with the internals of the Quaternion.

The internal x,y,z,w values ARE for you to use, but Kurt’s warning is a generic adviso against it. Since you’re actively trying to work with another API that provides the x,y,z,w, his warning is not meant for your situation.

You will need to double-check that your API is providing you Quaternion values designed for a LEFT-HANDED UNIVERSE, or you will need to change the chirality with something like (x,y,-z,-w) yourself. You should only provide Quaternion values that are properly normalized. Normalize (x,y,z) then normalize (x,y,z,w) overall.

2 Likes