1

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?

2
  • Collision detection is about determining whether or not a given point is located within a given shape (a polygon of points). It goes both ways. (1) is any (corner point) of A within B? If so, collision. (2) is any corner point of B within A? If so, collision. (3) no collision if not 1 or 2. For rectangles, there's usually a "built-in" point in rectangle method (or "intersects with"). In summary, you need a "Is point in polygon?" routine. Commented Feb 23 at 6:13
  • There's a lot to think about there. At the moment, I'm considering using a library like Jolt - I don't think I have the time or skills to roll my own. Commented Feb 24 at 3:26

1 Answer 1

0

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`
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.