My attempt at the popular ( velocity-less ) Verlet Algorithm written in Python. This is based on my JavaSscript implementation which can be found here.
A stripped down Arduino C version can be found here.
Basically all of this math has been pulled together from research online. I am definetley not good enough at math to come up with most of these equations myself, so the truly heavy lifting has been lifted / adapted from resources found all over the internet.
Really, this is mostly a passion project for me. There are many other libraries that would be faster and easier to use that exist, ofcourse. I mostly just want to learn the math, porting between languages, and I like to make my own libraries for fun / experience / learning.
The Javascript implimentation is my main focus at the moment, c#, python and C will come as I get time, but they will be based on the initial and proven Javascript implimentation.
ALOT
- Everything needs to honor a time delta.
- There should be a mode that scales the iterations depending on how bad the time deltas get.
- Add attractive and repulsive forces
- Add collision response callbacks ( which include collision information )
- look into adding quadtree or binary space partitioning to speed everything up
ALOT
- All the classes could be re-written and improved.
- OPTIMIZE OPTIMIZE OPTIMIZE.
- Any cheaper / less accurate ways to calculate things for speed? These make nice options.
- Some way to easily test all the math in the classes would be helpful.
- Mark objects (particles / constraints / bodies) as dirty / clean on update cycles so if they haven't moved then they don't need to be reconsidered this pass
- Add more prefabs and add more settings to each prefab so everything can be adjusted
- https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-oriented-rigid-bodies--gamedev-8032
- https://github.com/tutsplus/ImpulseEngine/blob/master/Collision.cpp
- https://gamedev.stackexchange.com/questions/74858/how-can-i-improve-my-collision-detections-performance
- https://code.google.com/archive/p/box2d/downloads
- https://stackoverflow.com/questions/345838/ball-to-ball-collision-detection-and-handling