## Quaternion - Even when CryEngine draws it out, I still don't get it

Moderators: cry-nic, Community Volunteers

### Quaternion - Even when CryEngine draws it out, I still don't get it

#1
I prefer thinking of a quaternion as an object that contains a vector and a scalar.
so I just vaguely understand quaternion as a vector with weight/scalar.
So I tried to visualize it in CryEngine.
As you can see, the code above will draw the velocity vector and velocity quaternion (I guess). But I don't understand what the meaning of the quaternion in the image above. 3 lines red,green,blue and a red square in the middle - I don't get what it's trying to show?

### Re: Quaternion - Even when CryEngine draws it out, I still don't get it

#2
Ok, so there is some hint
A quaternion doesn't have a direction by itself. It is a rotation. It can be used to rotate any vector by the rotation it represents. Just multiply a Vector3 by the quaternion.

Code: Select all

``` Vector3 targetForward = targetRot * Vector3.forward; Vector3 targetUp = targetRot * Vector3.up; ```
What axis you need you have to figure out yourself since your code is just an abstract collection of code fragments.
---------------------------------
Just to be absolutely clear for beginners: When you say "Which way is this Quaternion's up?" or "Which way does this Quaternion point forward?" what you probably actually mean is:
"If you take something which is standing straight up and forward, and apply the Quaternion to it, which way is the forward vector now?"
The example code above provides exactly that information.

### Re: Quaternion - Even when CryEngine draws it out, I still don't get it

#3
with this code to add it to debug
I guess m_lookOrientation.GetColumn0() is the red line (right of the character).
I guess m_lookOrientation.GetColumn1() is the red line (forward of the character).
I guess m_lookOrientation.GetColumn2() is the blue line (up of the character).

### Who is online

Users browsing this forum: No registered users and 1 guest