Jump to content

Rotation not being cloned


Xeonzinc
 Share

Recommended Posts

Hi,

I found this issue when cloning an imported mesh, but it seems to apply to everything:

ISSUE: A mesh rotated without the 'Quaternion' system does not have the rotation copied during cloning.

See the issue here: http://www.babylonjs-playground.com/#VMRND#1 (the rotate function converts the mesh to Quaternion, but setting rotation does not).

I've had a look through the source but didn't manage to find a likely cause.

 

Link to comment
Share on other sites

Wow! Super speed bug fixing! The mesh seems to be as expected now :) 

I also have a similar issue when cloning a skeleton from the same source (base imported version works fine, but cloned versions are distorted) - I hoped the above might fix it, but no luck. Although I have no idea if that is a rotation problem (no method to make a test playground as bone matrices confuse me...)

Link to comment
Share on other sites

Thanks guys, yes i was basing my test around those demos, very useful :)

A bit more investigating makes it look like it's not the skeleton cloning, but potentially still the mesh cloning - Wingnut's code adjusted for my mesh has very strange results... http://babylonjs-playground.com/#18U5SO#6

Cloned meshes seems to be distorted when using the same skeleton.....Digging further - manual checking of the two mesh objects shows these differences:

         1) _boneTransformMatrices is different between then (same array size, but different values)

         2) _poseMatrix is different between then...

         3) cloned mesh has a undefined  _rotationQuaternion: where as base does not

         4) base mesh has undefined  _waitingActions: while clone does not

Does any of this ring alarms? Or am I just highlighting expected differences between meshes :blink:

Link to comment
Share on other sites

I'm happy to help where I can, although I feel like I just pop up and highlight mysterious issues rather than offer actual solutions :P  ... maybe I'll understand it all enough one day :) 

That said - your fix works great when using the the same skeleton, but breaks down for cloned skeletons (mesh 3 gets the same kind of distortions we were seeing before): http://babylonjs-playground.com/#18U5SO#14

Using my tried and test method of helping....

     - Mesh 3 (with the cloned skeleton) doesn't appear to have a _bonesTranformMatrices

     - The cloned skeleton on mesh 3 has nothing in it's _meshesWithPoseMatrix (the other skeleton has the other two meshes as expected)

     - The cloned skeleton on mesh 3 has a very different _transformMatrices (which actually looks similar to the _bonesTransformMatrices on the other two meshes....)

My attempt to make swap around a _transformMatrices with a _bonesTransformMatrices in the babylon source has resulted in a very different error, so I will leave it here...

Link to comment
Share on other sites

No problem :) - I think this is still clone related, so I'll keep it in here:

Chains of cloned mesh/skeletons seem to be linked, and starting animations propagates through somehow - see here: http://babylonjs-playground.com/#18U5SO#18

You can use the three beginAnimation lines to start either 1,2 or all 3 of the meshes going at once. All I've managed to figure out is that it's based on the order which the mesh clones are built. For some reason starting animations on rabbit2 also starts rabbit3, but starting rabbit3 does not start rabbit2. Potentially related to the fixes you made above...?

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...