# Quaternion, w-component

Hello everyone, can someone describe me how to use w component ?
As i understand, x,y,z describes a unit vector of rotation. What about w ? I saw that as smaller it is, as more it rotates a body.
How can i rotate over axis y, 30 degrees ?

``````transform.rotation = new Quaternion(0,1,0,radius)
``````

What should be radius there for rotating body with 30 degrees ?

Sorry, but you have it all wrong.

X, Y, Z and W inside of a quaternion describe the complete rotation as a 4th dimensional hyper-sphere that represents all equivalent rotations in x, y and z to get to that final position.

yes, I know you didn’t understand that. Just accept that the values are a mystery to you.

What you are thinking of is called “euler angles”. You need to convert those to and from quaternions.

To do so you use:

Unity - Scripting API: Quaternion.Euler (to create a Quaternion from euler angles)

and

Unity - Scripting API: Quaternion.eulerAngles (to convert a Quaternion to euler angles.)

To create a rotation of 30 degrees around the Y axis you use

Quaternion.euler(0,30,0);