aWeirdo Posted May 26, 2016 Share Posted May 26, 2016 Hi, i notised this bug a while ago, but never got around to reporting it before now, As shown in the following PG, the mesh.lookAt appears to rotate the mesh and the mesh "looks" at the object, but it doesn't actually update the mesh.rotation. the lookAt target is a sphere aproximately 45* from starting point. PG controls: left mouse click: lookAt & move based on mesh.rotation.y. mouse wheel click: rotate 90* and move based on mesh.rotation.y. right mouse click: move based on starting mesh.rotation.y. http://www.babylonjs-playground.com/#BJZC6#3 The lookAt method also seems to lock the target on 0 rotation.y, any new changes are completely ignored / overwritten. Console.log's of before and after each action (right-click only log's one line). 1 left mouse click(LookAt) & 2 mouse wheel clicks(+90*): VM379:45 Box.rotation.y Before lookAt: 0 VM379:48 Box.rotation.y After lookAt: 0 VM379:50 Box.rotation.y Before 90* rotation: 0 VM379:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM379:50 Box.rotation.y Before 90* rotation: 0 VM379:53 Box.rotation.y After 90* rotation: 1.5707963267948966 1 mouse wheel click(+90*) & 1 left mouse click(lookAt) & another mouse wheel click. VM385:50 Box.rotation.y Before 90* rotation: 0 VM385:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM385:45 Box.rotation.y Before lookAt: 1.5707963267948966 VM385:48 Box.rotation.y After lookAt: 0 //reset to 0..? VM385:50 Box.rotation.y Before 90* rotation: 0 VM385:53 Box.rotation.y After 90* rotation: 1.5707963267948966 //This doesn't effect anything. 4 mouse wheel clicks(+90*): VM378:50 Box.rotation.y Before 90* rotation: 0 VM378:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM378:50 Box.rotation.y Before 90* rotation: 1.5707963267948966 VM378:53 Box.rotation.y After 90* rotation: 3.141592653589793 VM378:50 Box.rotation.y Before 90* rotation: 3.141592653589793 VM378:53 Box.rotation.y After 90* rotation: 4.71238898038469 VM378:50 Box.rotation.y Before 90* rotation: 4.71238898038469 VM378:53 Box.rotation.y After 90* rotation: 6.283185307179586 1 right-mouse click(no rotation altering) & 2 mouse wheel clicks(+90*) & 1 right-mouse click again: VM380:55 Right-click, No rotation altering: 0 VM380:50 Box.rotation.y Before 90* rotation: 0 VM380:53 Box.rotation.y After 90* rotation: 1.5707963267948966 VM380:50 Box.rotation.y Before 90* rotation: 1.5707963267948966 VM380:53 Box.rotation.y After 90* rotation: 3.141592653589793 VM380:55 Right-click, No rotation altering: 3.141592653589793 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted May 26, 2016 Share Posted May 26, 2016 Hello! LookAt updates the quaternion: https://github.com/BabylonJS/Babylon.js/blob/master/src/Mesh/babylon.abstractMesh.ts#L762 aWeirdo 1 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted May 27, 2016 Author Share Posted May 27, 2016 @Deltakosh ahh.. i guess it was never even supposed to update the rotation values then.. Doh GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted May 27, 2016 Share Posted May 27, 2016 However, you can always convert quaternion => Euler for update the value rotation.y . mesh.rotation.y = mesh.rotationQuaternion.toEulerAngles().y; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.