satguru Posted March 5, 2016 Share Posted March 5, 2016 changing rotation from quaternion to euler resets the mesh rotation consider this http://www.babylonjs-playground.com/#ZTNIZ Here I am just rotating the cube by 45 degree around y axis. This works as expected. Now just convert the rotation to euler http://www.babylonjs-playground.com/#ZTNIZ#1 And the cube goes back to its previous rotation !! Quote Link to comment Share on other sites More sharing options...
satguru Posted March 5, 2016 Author Share Posted March 5, 2016 I was playing around with this a little more and found that if I set the quaternion rotation to null after I change the rotation to euler then the cube rotation is not reset see http://www.babylonjs-playground.com/#ZTNIZ#2 So it looks like now, at any time the rotation can be either in euler or quaternion but not both. Right ? Quote Link to comment Share on other sites More sharing options...
Kesshi Posted March 5, 2016 Share Posted March 5, 2016 The rotationQuaternion has priority over the rotation property. If rotationQuaternion is not null the rotation property is ignored. The rotate function of the mesh operates on rotationQuaternion. I would recommend not to use the rotation property at all ... Or you should remember that you should never use rotationQuaternion or any function which operates on it. In my opinion the rotation property should be removed. Instead some helper/utility functions could be added for people who want to work with euler angles. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted March 5, 2016 Share Posted March 5, 2016 5 hours ago, satguru said: So it looks like now, at any time the rotation can be either in euler or quaternion but not both. Right ? Yes, it is or Euler or Quaternion. Even 3ds max offers one or the other, but not both. We must convert every time you need Euler => Quaternion and Quaternion=> Euler Quote Link to comment Share on other sites More sharing options...
satguru Posted March 5, 2016 Author Share Posted March 5, 2016 I guess having both could be confusing to the engine. It probably makes sense to use one rather than both. But I wonder about the new behavior of resetting the rotation, when both are used. Is this by design or is the unintended consequence of some other change? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 7, 2016 Share Posted March 7, 2016 We need to have both because a lot of users won't understand (or even need quaternion). I admit this is a bit misleading but we have extensive documentation about it @satguru: The rotation is reset when using quaternion as an attempt to share the message: DONT USE BOTH Quote Link to comment Share on other sites More sharing options...
satguru Posted March 7, 2016 Author Share Posted March 7, 2016 @Deltakosh Thats fine. I ran into this issue with my EditControl app. The edit control uses quaternion, but after rotation it would also update the euler value to sync it up with the quaternion value.I did this to make it convenient for the EditControl user in case they were using Euler. Going forward I will remove this and just add a note in the documentation. If the user wants to use euler then they can update the euler from the quaternion and set the quaternion to null. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 7, 2016 Share Posted March 7, 2016 Actually there was a bug I've just fixed it.. You can now use rotation as expected 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.