AlexMuir Posted October 28, 2018 Share Posted October 28, 2018 I'm completely stumped by my inability to rotate an imported mesh which is then cloned. It took me a long time to isolate the issue into a playground but I've finally done it and I'm sure one of you is going to tell me something obvious. I have a library of meshes (imported from GLB files). I clone a mesh and add it to the scene and I can set the rotation using clone.rotation = BABYLON.Vector3.FromArray([1,0,0]); The clone is successfully rotated, but almost immediately (on the next rendering call, I'm guessing) the rotation is lost on the clone. Which means that when I later set: clone.rotation = BABYLON.Vector3.Zero(); the object does not return to its original rotation. In other words, setting the rotation on cloned meshes seems to be cumulative. This behaviour differs from a built mesh which does exactly what I would expect. I have shown both examples in the playground - hopefully it makes more sense there! https://playground.babylonjs.com/indexStable.html#PN1NNI#97 Quote Link to comment Share on other sites More sharing options...
Raggar Posted October 28, 2018 Share Posted October 28, 2018 https://playground.babylonjs.com/indexStable.html#PN1NNI#98 In the exporter - at least the one for Max, models are exported with the rotationQuaternion property set. When this is the case, .rotation is not used. Either null out the rotationQuaternion, or rotate the model/clone using one of the methods that supports quaternion rotations. ssaket 1 Quote Link to comment Share on other sites More sharing options...
AlexMuir Posted October 28, 2018 Author Share Posted October 28, 2018 Wonderful! Thank you very much. Such a responsive community around this project! Quote Link to comment Share on other sites More sharing options...
Guest Posted October 29, 2018 Share Posted October 29, 2018 Flagging as solved (thanks @Raggar :)) 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.