brucewong21 Posted November 25, 2017 Share Posted November 25, 2017 So a gotcha of the moveWithCollisions method is that it uses an ellipsoid mesh to calculate collisions of your mesh instead of the original mesh dimensions. I see a clear way to remove your original mesh but how do we remove the ellipsoid mesh from the scene? I'm worried that keeping these ellipsoids even when my original mesh has been disposed of will hurt performance. Thank you so much. Quote Link to comment Share on other sites More sharing options...
Wingnut Posted November 25, 2017 Share Posted November 25, 2017 Hi BW. Somemesh.ellipsoid is not a mesh, it is an "area". It will be gone with somemesh.dispose(), of course. BUT, are you using a Wingnut function called BABYLON.Mesh.prototype.showEllipsoid()? Are these "ellipsoid mesh"... wireframed spheres? If so... do this... somemesh.ellipsoidMesh.dispose(); ... after that.. somemesh.dispose(); Should work to kill those add-on sphere shapes. Of course, you might wish to console.log(somemesh.ellipsoidMesh) to see if a mesh is there. It might be so. https://www.babylonjs-playground.com/#WWCK0#36 (lines 2-33) Wingnut written "utility function" to show collision ellipsoids. If you are using that, then yes... first somemesh.ellipsoidMesh.dispose(), and then somemesh.dispose(). Good idea. I hope this helps. Report back, please. (thx) Quote Link to comment Share on other sites More sharing options...
brucewong21 Posted November 26, 2017 Author Share Posted November 26, 2017 Hello sorry just saw this now. I will check it out thank you! Quote Link to comment Share on other sites More sharing options...
brucewong21 Posted November 26, 2017 Author Share Posted November 26, 2017 7 hours ago, Wingnut said: Hi BW. Somemesh.ellipsoid is not a mesh, it is an "area". It will be gone with somemesh.dispose(), of course. BUT, are you using a Wingnut function called BABYLON.Mesh.prototype.showEllipsoid()? Are these "ellipsoid mesh"... wireframed spheres? If so... do this... somemesh.ellipsoidMesh.dispose(); ... after that.. somemesh.dispose(); Should work to kill those add-on sphere shapes. Of course, you might wish to console.log(somemesh.ellipsoidMesh) to see if a mesh is there. It might be so. https://www.babylonjs-playground.com/#WWCK0#36 (lines 2-33) Wingnut written "utility function" to show collision ellipsoids. If you are using that, then yes... first somemesh.ellipsoidMesh.dispose(), and then somemesh.dispose(). Good idea. I hope this helps. Report back, please. (thx) Sorry for the long delay in my response, I was trying to make a PG (no pain no gain ) but couldn't recreate the same situation. I was not using the Wingnut utility function btw so it's all good there! As usual, my own stupidity overcomes me again! If you don't want to waste time don't read below. It seems that what was left behind after my mesh.dispose was not an "ellipsoid mesh" but rather an InstancedMesh object. I originally created my mesh like so monsterInstance.hitbox = monsterType.hitbox.createInstance(); I tried to dispose of the mesh as so... monsterInstance.hitbox.dispose(); It was leaving behind a InstanceMesh object which was still being affected by my other meshes colliding with it. After trying to recreate the error in PG, I eventually found out I was attaching the onCollide handler twice. I was calling the dispose method on my second onCollide handler. I never knew about these Wingnut functions and the utility one to see the ellipsoid will definitely help me! Thanks for your answer Wingnut 1 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.