• News

• Industries

• Learning & Support

• Community

• Marketplace

# What is the 'W' value in Rotator?

When you Copy a value of Transform variable, you get this format:

(Rotation=(X=0.000000,Y=0.000000,Z=0.000000,W=1.000000),Translation=(X=0.000000,Y=0.000000,Z=0.000000),Scale3D=(X=1.000000,Y=1.000000,Z=1.000000)) (Example when Rotation = (0,0,0))

(Rotation=(X=-0.258819,Y=-0.000000,Z=0.000000,W=0.965926),Translation=(X=0.000000,Y=0.000000,Z=0.000000),Scale3D=(X=1.000000,Y=1.000000,Z=1.000000)) (Example when Rotation = (30,0,0))

(Rotation=(X=-0.500000,Y=-0.000000,Z=0.000000,W=0.866025),Translation=(X=0.000000,Y=0.000000,Z=0.000000),Scale3D=(X=1.000000,Y=1.000000,Z=1.000000)) (Example when Rotation = (60,0,0))

… What is the ‘W’ value in the Rotation? I’m trying to convert Transform values into a String in the same form, but I can’t figure it out… From Rotator we can get only the X,Y,Z values, there is no W value… Any clues?

Edit: I’ve found out that it’s probably in the Quaternion format, for some reason. So looks like now I must find a way to convert Rotator (X,Y,Z) to Quaternion (X,Y,Z,W)…

Edit 2: I’ve found a solution for converting Euler to Quaternion, here: http://stackoverflow.com/questions/12088610/conversion-between-euler-quaternion-like-in-unity3d-engine

Yes it is part of Quaternion notation, you are on right track. Quaternion enables you to make rotations without “gimbal lock” problem which Euler notation suffers from.