0
\$\begingroup\$

Using collision detection algorithms such as MPR (Minkowski Portal Refinement), GJK (Gilbert–Johnson–Keerthi distance algorithm), you can calculate the penetration depth in the collision.

For 2 mesh colliding, how to know the volume of collision, or the intersection between them?

\$\endgroup\$
2
  • \$\begingroup\$ Could you elaborate on "intersection between them"? Do you mean volume of such intersection? \$\endgroup\$ Jul 5 '21 at 15:24
  • \$\begingroup\$ @CandidMoon_Max_ i meant the overlaying area/volume under collision. \$\endgroup\$
    – Error
    Jul 6 '21 at 10:48
1
\$\begingroup\$

I am by no means a Blender or collision expert but I assume you have access to internal code of Blender https://github.com/blender/blender , I believe what you are trying to achieve needs calculations that happen during collision tests unless Blender exposes some api that allows you to get vertices of intersection. Getting these vertices should be possible during collision test of course.

  • A - collider.
  • B - collider.

You can use these vertices to calculate a volume of intersection but you will need "imaginary" vertices which are a product of intersection of [A] planes(collider's planes that are defined by its vertices) by edges between [B] vertices that penetrated this collider's [A] planes and the other collider [B] vertices that haven't penetrated these [A] planes.

https://en.wikipedia.org/wiki/Gilbert–Johnson–Keerthi_distance_algorithm#/media/File:Two_types_of_collisions_and_corresponding_CSO_faces.svg

On the first image you can see a pyramid created by intersection of a plane. This pyramid vertices is what you need to calculate the volume in this case.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .