In this zip-file is the sourcecode for the collision system of Grappling Hook:
http://ghook.speedrungames.com/download/GrapplingHook_src_physics.zip
Features:
- entirely written in Java
- optimized for the use in Grappling Hook
- no allocations during updates
- supports collisions between axis-aligned-bounding-boxes, rays, and points
- supports both static and dynamic AABBs
- depends only on com.jme.math.Vector3f, so it could be used without jme with only a bit work
How to use it?
The main-class is physics.PhysWorld. You have access to almost all functionality with this class. It is best to have a look at this class first, when you want to use the system.
There are not many comments in this class, but the names of all functions and variables should give you a clue, what they do.
This is not a library. It is optimized code of a released project. That means that there can be optimizations, which are not useful for other projects. I don't recommend to paste the code into other projects without reviewing it.
I hope it will be helpful for some of you as a reference, when you try to implement your own collision-system.
When it is useful, a credit would be great, but is not required.
Edit: Please note, that this does not provide any physics simulation. This is only for collision-detection. You have to write the whole velocity/acceleration/force/torque… code by yourself.