DanielChappuis / reactphysics3d

Open source C++ physics engine library in 3D
http://www.reactphysics3d.com
zlib License
1.54k stars 224 forks source link

Collision detection in an octree #328

Open v71 opened 1 year ago

v71 commented 1 year ago

Good day, before adopting reactphysics3d in my projects , I'd like to know if it is possibile to create a convex shape as a collison mesh for each node of an octree, in a way that if an object is inside the node, the physcs engine would provide collison detection and response only for the surfaces contained in the node itself and not for the entire mesh containig all the triangles in the collision mesh. I hope I've been clear

DanielChappuis commented 1 year ago

I am not sure if I really understand your question but all the bodies of the world in ReactPhysics3D are part of an AABB tree structure (similar to an octree). The first part of the collision detection is the broad-phase collision detection where we compute all the pair of bodies that need to be tested later during the narrow-phase collision detection. When we create a concave mesh (triangle mesh or heightfield) an internal AABB tree is generated for that only to store all the triangles in a AABB node. In ReactPhysics3D, there is no internal AABB tree for a convex mesh.

Can I please ask you next time to ask this kind of questions in the discussions section instead of opening an issue?