W-component of entity setRotation / setLocalRotation

Hello and happy new year!

I’m wondering about what the W-component should be when trying to rotate an entity with Element component (as a sub-object of screen).
If I omit the W-component, it’s probably set to 0 and the object disappears. If I set it to 1 i starts rapidly scaling upwards. I’m assuming it should be 1/something, but what is the “something” ?

I made an example project here: https://playcanvas.com/editor/scene/854600

Hi @Mr_T,

When using setRotation and setLocalRotation the arguments you pass are Quaternions which is a different way of expressing rotation angles. It isn’t easy to express a Quaternion to something visually understandable but as a system it solves many problems that regular euler angles have.

If you would like to rotate your objects using a more traditional way (euler angles) use setEulerAngles and setLocalEulerAngles instead.

Take a look at this on how the two systems relate:

Thanks, setEulerAngles works.

1 Like