Jump to content

Precision mesh collision detection


garidan
 Share

Recommended Posts

I need to perform a precise mesh collision detection: meshes have strange shapes but are very few and the scene is almost static, only one mesh at a time is drag and dropped in the scene, so there's no computational resources problem.

 

I already tried with "usePreciseIntersection: true" but calling it precise ..... it's not:

 

meshes[0].actionManager.registerAction(new BABYLON.ExecuteCodeAction(
        { trigger: BABYLON.ActionManager.OnIntersectionEnterTrigger, parameter: { mesh:meshes[1], usePreciseIntersection: true } },
        function () {
             meshesMaterial[0].diffuseColor=BABYLON.Color3.Red();
        }));

 

Reading at the link below, I need a sort of "mesh collider".

Any idea ? Any external library or "trick" ?

Thanks

 

http://blogs.msdn.com/b/davrous/archive/2014/11/18/understanding-collisions-amp-physics-by-building-a-cool-webgl-babylon-js-demo-with-oimo-js.aspx

Link to comment
Share on other sites

Actually there is no mesh vs mesh intersection or collisions. This is far too slow to do

BUT if you want to do it by yourself you can check every triangle of first mesh with every triangle of the second mesh

(Check the collider class to get an triangle testing function)

 

But warning: this will be SOO SLOOOWWWW :)

Link to comment
Share on other sites

OK, I think I need a Bounding Volume Hierarchy (BVH)

 

 

The bounding volume hierarchies of two objects are traversed recursively. The recursion stops at the leaves and at disjoint bounding volumes. Whenever two BVs overlap, one of them is tested against the children of the other one.

 

If ever I do this, I'll let you know :-)

 

bvh_elicopter.jpg

 

http://image.diku.dk/projects/media/christian.bay.kasper.andersen.06B.pdf

Link to comment
Share on other sites

  • 1 year later...

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