[LWJGL] 3D Collision

I’m writing a 3D Gaming library in conjunction with LWJGL for future use. I find myself spending more time on programming the same thing over and over again for each project I decide to start, so a library seems like a good idea. I actually used the incomplete library for Ludum Dare 35 and it worked great!

I’ve got models, shaders, etc etc support in my library. Tons of rendering tools. However, I’ve yet to set up any sort of physics portion of the library and had to resort to AABB collision detection for LD35, and I’d really like to get started on that before I go deeper into rendering with animation/lighting and stuff. Any ideas on how I would start on collision-detection for 3D models?

Here are some thoughts but I truly have no idea. I’ve always shied away from physics anytime I do something in 3D because I have no experience with it.

So my thoughts:
My library makes use of entities. Each “Entity” has a number of rendering components. My thoughts are I should add two more components to a class extending an Entity that allows for physic calculations. I say two because I’m thinking a simple collision model with far fewer vertices than the model being rendered, and then a more complex collision model that more closely resembles the model being rendered. This seems like a good idea (I think? No clue :)), but even with this basic concept I still have no idea how I’d go about detecting collision between two 3D models that aren’t mathematical shapes (pyramid, cube, etc). Then that begs the question should I handle collision differently for models generated from heightmaps? The heightmap model is stored temporarily in the same format as a Blender OBJ model for rendering, but image-data is stored as well in case I ever need it for collision. There are so many things I don’t know that I don’t know where to start either.

Could someone please advise or point me in the right direction? Thanks, any and all help is appreciated! :slight_smile:

Oh! And here’s a screenshot of a game I made in 48 hours using what I’ve written with the library so far! Library is extremely early in development but it was still great seeing it work and be able to produce something. :stuck_out_tongue: