3dcollision-detectiongame-developmentmeshraylib

How can I detect collision between a box and a minimum poly collision mesh?


Mostly a C++ newbie, trying to do a 3D game in Raylib.

I have a set of fairly irregular meshes that I'd like to see if a box collider has penetrated. For this project, a fairly high level of accuracy would be required. I have no problem making some VERY low poly resolution collision meshes (eg. 3-sided columns for the stems), but I really have no idea how I'd start writing such collision code.

Mushroom models that need to be tested against

Can anybody give me some advice on this, or point me at some starter code?


Solution

  • In the end, my team made simplified box collision meshes for all the objects. As all the colliders were axis aligned bounding boxes, were were able to just use Raylib's built-in bounding box collider code, while doing a few simple distance / radius checks to cull the work to a performant level.

    `bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);                                 // Check collision between two bounding boxes`