Jump to content

Rotating cloned imported mesh


AlexMuir
 Share

Recommended Posts

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

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...