# rotationQuaternion only update the last value why?

Hi EveryOne.

I have scenario where i want to change my object x,y,z world. so what i am doing is to rotate object by 90 degree on y-axis and then rotate it on x-axis with 90 degree.By doing so i get my object at desired x,y,z.
But rotating by using rotationQuaternion only rotate by x-axis not y-axis. why this happening?
PG

``````box.rotationQuaternion = new BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(0, 1, 0),Math.PI/2);
box.rotationQuaternion = new BABYLON.Quaternion.RotationAxis(new BABYLON.Vector3(1, 0, 0),Math.PI/2,BABYLON.Space.LOCAL);
``````

Every time you say `box.rotationQuaternion =` you assign a new quaternion. So on the second line you ignore the first quaternion and overwrite it with the new one, so only the y-axis is rotated.

You could rotate the mesh instead:
https://www.babylonjs-playground.com/#6XIN1E#1

Thanks @Raggar

Actually i have tried with rotation it works fine. But the my problem is that i receive Quaternion values from somewhere outside and then update the geometry. I have convert Quaternion to Axis-agnle and then rotate object works fine. But then its keep rotating for same value again and again.
For example. I receive continues values to update the rotation of box. first i received to ratate y-axis by 90 degree then same value agian and agian. What i want is rotate the box only with new values. The box should only rotate if the value is different from current position. Sorry if it doesnâ€™t sound very clear.

For clarity are the quaternion values you receive giving a change in orientation or a new orientation?

@JohnK
Lets say i have physical rotating disc. I receive Quaternion(x,y,z,w) value of this disc every 100ms. At beginning my Desk is at (0,0,0,0). now i change my desk orientation to (.2,.3,.5,.002) and i will receive this value every 100ms. So if i use mes.rotation(.2,.3,.5,.002) mesh will keep rotating with this value in every 100ms. I want only to rotate it from (0,0,0,0) to (.2,.3,.5,.002) and then should stay there at (.2,.3,.5,.002) unless until physical disc rotation change again.
All Quaternion value i received are when disc rotate it give new orientation with respect to origin of the desk.

It seems you need to interpolate between one quaternion to another:

https://www.babylonjs-playground.com/#6XIN1E#3

The array simulates received quaternions. https://www.babylonjs-playground.com/#6XIN1E#4