Hi all I’m trying to find a good resource for learning how to handle storing cuboids and perhaps the physics behind collision detection. I’m familiar with rigid body dynamics, although I’m struggling on how I’d use it for my purposes. Does anyone have any good learning resources they could share? Thanks in advance!
Physics are really complex.
[x] If you want 2D physics in java: you maybe go with libGDX’s box2D-wrapper. It is said to be faster than JBox2D, a Java-implementation of the Box2D physics engine.
[x] If you want 3D physics, try out JBullet. Bullet was originally a 3D-physics engine. It then was ported to many other platforms including JBullet. Try it out
I’ll definitely have a look at that JBullet, cheers! If anyone has any book or online tutorials I can have a read through, that’d be great too.
There is actully not much physics going on behind the actual collision detection. Collision detection is just to check if somethings are overlapping. If they are you have to solve this with a “collision respons” and that´s where the physics really come in handy (for example, do things bounce, do things break and so on). I know this might seem a bit nitpicky, but to me it turned out to be a pretty big deal since it meant a lot more work! So I would advice you to read up on collision detection, collision respons and the integrator. That´s basically the foundation of what you need for your physics, then you can make it as simple or as advanced as you want. Don´t do what I did, though. I got carried away!
Now, you wanted something to read. I like Chris Heckers series of articles:
http://chrishecker.com/Rigid_body_dynamics
This blog post “physics engine for dummies” is also pretty nice for a place to start:
http://www.wildbunny.co.uk/blog/2011/04/06/physics-engines-for-dummies/
If you’re using the Slick2D framework, you can give every collidable entity in your world a Shape for a hitbox. There’s a bunch of methods in Shape to check for collisions.