A simple 3D rigid body physics example

Hey all,

I’ve just overhauled an MG project which I think could be useful for other game developers. It’s a 3D rigid body physics demo, designed to provide a clean and minimal introduction to realistic dynamics. If, like me, you’d like to learn about this area without having to use a bloated ‘black box’ physics engine which may not fit nicely with your code, then perhaps playing with this project will be of some help!

Thanks for looking :slight_smile:

2 Likes

I have only looked through the code yet.

Looks very clean, good job! The only thing that might make it even cleaner is to avoid magic numbers in code, like penetration depth multiplication or offset with something like 0.004. This is better solved as a constant defined outside the function or at the beginning. Or the multiplication with 100 afterwards (all of that in the main function)

1 Like

Thanks for looking, and for the compliments! I’ve removed the magic numbers in the collision code now, and added a few comments in other places to give some hints :slight_smile: