Jump to content

[Fixe] Clone and Instance for mesh with physics


Dad72
 Share

Recommended Posts

Physics is not enabled on this scene. The physics engine is missing and therefore fails. Turn on the log in the debug console and you'll see the error.

But i found a different bug with the mesh's deep copy which I didn't take into account. Fixing.

I tested it a bit differently (I don't reference the impostor in the mesh anymore, so DeepCopy didn't catch it). But I found a different problem - the clone of the mesh was not updated for some reason (missing the physics clone). Need to check what happened there. Anyhow, fixing all of the bugs right now.

 

Last edit - the clone command moved to the mesh constructor, but the references were not altered correctly. PRed a fix, will be ready this evening.

Link to comment
Share on other sites

okey. Have you seen this error too. I activate the phisics that I forget I have this error now. You have it may be fixe for the next ?

Cannot read property 'rotationQuaternion' of undefined

Thank you Raanan

 

Link to comment
Share on other sites

Ok!

cloning works, but a new problem appeared. The meshes will always collide on the first frame of creation, as they essentially have the same position.

I have a solution already, I just want to see how to integrate it correctly. I'll keep you posted here. here is a working version, notice line 35, which is the temporary solution - http://www.babylonjs-playground.com/#1GDJ17#5

Link to comment
Share on other sites

I like the solution beforeStep().

I hope you will come to find the solution for Cannon. Thank you Rannan  for the hard work you do on the physics engine.

with Oimo, it looks like the sphere penetrates into the soil

Link to comment
Share on other sites

Yes, watching on my model, there is no impostor on the model to clone.
Yet the basic model I clone, there is an impostor created. I do not understand why.
I use a model created with ImportMesh and not a primitive, which may be the problem with the model created with ImortMesh. But this is a hypothesis.

I try on a scene with ImortMesh playground and there is a problem that I do not understand when I clone the object. Looks like it hit the one and the other, despite their distance. by against the clone has a impostor, so I do not know why my clone model without impostor ? 

http://www.babylonjs-playground.com/#1GDJ17#10

I also found a problem with MeshImpostor (But I guess we'll see after that or something else.) :

http://www.babylonjs-playground.com/#1GDJ17#9

Link to comment
Share on other sites

I made my tests listed in trying to understand, but I do not understand. My basic purpose has an impostor as shown here:

impostor.jpg.061c21fc328b1f3cf1213b086f8

Now if I clone this object, the impostor is not created as shown here:

no_impostor.jpg.79cb6a998d3450c412c9c6cc

for the code I use is this:

var name = global.objetSelected.name;			
console.log(global.objetSelected); // impostor exist			
global.objectsFreeze[name] = global.objetSelected.clone(name);			
console.log(global.objectsFreeze[name]); // impostor null
global.objectsFreeze[name].physicsImpostor.beforeStep();//property 'beforeStep' of null

I use the latest version of Babylon to day and I emptied all my covers to be sure it does not come from there.

If you need my model, I can send it to you by PM.

Thank you Raanan  for your time.

[EDIT] oops, looking at the deposit, your last pull request has been added, but minimize file (Babylon.min.js) was not built. I guess this is why cloning does not work for me. but why it works on the playground?

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