[SOLVED] Set Euler Angles problem

Hello everyone,

I have a problem when setting an object to an specific angle rotation in one axis.

if (storageAvailable('localStorage')) {
        anguloInicialIntensity = localStorage.getItem('angle');
        console.log("init: " + localStorage.getItem('angle'));
        //this.entity.localEulerAngles().y = parseFloat(anguloInicial);
        console.log("x: " + this.entity.getEulerAngles().x + "an y: " + this.entity.getEulerAngles().y + "z: " + this.entity.getEulerAngles().z);


i have tried this options but none of them work. As you can see in the following screenshot both .y and .z do what they want, instead of positioning where i told them to be:
(y should be equal to init. In this picture: y = 0.535)

I do not know what else to do

Thank you for your time!

The local storage keeps the number as a string type. When you do::


that will use .setEulerAngles(number, string, number), which is not a correct syntax.

1 Like

Is there a correct way to do this?

Yes, the one that is commented out should be ok to use:


Parsing a string to get a number first, and then using it to set the angle is a correct way.


Tried that but did not work, that is why i commented it.
Btw I do not know how but now it does as i order it to do, so it is solved. Thank you a lot!

1 Like