satguru Posted January 27, 2016 Share Posted January 27, 2016 If I rotate a mesh using the rotate() function the Mesh.rotation value is set to zero. Bug or expected behavior ? See http://www.babylonjs-playground.com/#1A70YP Regards Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 27, 2016 Share Posted January 27, 2016 It's not a bug, it's a feature Joke aside, it's because you can rotate meshes in two different ways: - with '.rotation' - with '.rotationQuaternion' mesh.rotate uses the rotationQuaternion attribute : when this atribute is set, rotation is completely ignored. satguru 1 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 27, 2016 Share Posted January 27, 2016 I send a solution here: http://www.html5gamedevs.com/topic/20102-babylonjs-editcontrol/#comment-114524 satguru and GameMonetize 2 Quote Link to comment Share on other sites More sharing options...
satguru Posted January 27, 2016 Author Share Posted January 27, 2016 @Temechon, Interesting feature I can see why setting ".rotation " cannot change ".rotationQuarternion" or vice versa. After all we are just changing a property/variable. Maybe ".rotation" or ".rotationQuarternion" should be private and there should be setter methods ".setRotation() " or ".setRotationQuarternion()". This way when one is set the other can be updated. Regarding ".rotate()" . It is a method, so don't you think it would be a good idea for it to update both the property values ? @Dad72, Thanks, I will check your solution Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 28, 2016 Share Posted January 28, 2016 These two properties have two different use: once rotationQuaternion is used, rotation is useless (so set to 0). Quote Link to comment Share on other sites More sharing options...
satguru Posted January 28, 2016 Author Share Posted January 28, 2016 I think if there are concerns related to using both "rotation" and "rotationQuaternion" togather then those should be documented Might be a good idea to document this in the rotate API at least I would even go as far as documenting it as a warning Something to the effect that "Please note that rotate() will reset the "rotation" value to zero. If you expect to use "rotation" , please consider setting its value from "rotationQuaternion" using the "rotationQuaternion.toEulerAngles()" function. You might get unexpected results otherwise". Regards Quote Link to comment Share on other sites More sharing options...
Temechon Posted January 28, 2016 Share Posted January 28, 2016 Please feel free to update it Go here: https://github.com/BabylonJS/Documentation/blob/master/content/classes/2.2/AbstractMesh.md, click on the pen icon, copy-paste your comment and submit ! Easy Quote Link to comment Share on other sites More sharing options...
satguru Posted January 30, 2016 Author Share Posted January 30, 2016 @Temechon, Thanks for the link. I have created a PR to update the doc. 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.