3D Physics Engine Demo in Java
Turn captions on please ! I have written this physics engine in java using opengl for the rendering, here are the results. Main features: *Arbitrary static geometry and infinite worlds *Rigid bodies can be made up of several arbitrary convex hulls built on the fly from input vertices / spheres / capsules (not shown in the video) *Several constraint types: spring, rope, weld, rotation & translation axis, angular & linear motors, wheels. *I took great care to reduce the memory footprint as much as possible and keep the garbage collector happy :) (the contacts are cached and reused, no memory allocation unless new contacts are created) How it works: My main source of information was that page: https://box2d.org/downloads/ You can learn everything there, even though it's in 2D. That mean you will have to work a bit more to adapt the concepts to 3D ;) I used the following algorithms / data structures: *Broad phase: -grid & octrees to retreive the relevant triangles of the static geometry -bounding volume hierarchy of AABBs (aligned axis bounding boxes) for the body vs body contacts. *Contact creation: -Separating axis theorem (SAT) for convex hull vs convex hull -GJK for sphere / capsule vs convex hull *Constraint solver: -sequential impulse solver: impulses are applied sequentialy until the constraints are satisfied or a fixed number of iteration is reached. That means that performance is tightly bound with the quality of the simulation since more iterations will enable more accurate results. *Time stepping scheme: -Semi-implict Euler integration for velocity and rotation. -Implicit Euler integration for rotation when gyroscopic movement is enabled. Known limitations: *Warm starting isn't implemented yet, that is why there is some jittering and some objects can take a while before going into sleep mode. *No time of impact solver, fast moving objects can tunnel through walls. *No parallelism: the algorithm is single-core only. *Some bugs can happen during the contact creation phase which lead to incoherent contact points. That's all, I hope you like it :)
Download
0 formatsNo download links available.