Thought i’d give a 3d physics engine a go.
Only have spheres and basic planes working, its going well so far, but i’m expecting some problems/limitations.
Still needs cubes,polygons, and some of the variables (gravity,density,restitution).
I’m making the sytax as similar to codea’s 2d physics as possible so it should be familiar and easy to use.
physicsEng = PhysicsEngine()
obj = physicsEng:body(SPHERE,50)
obj.linearVelocity = vec3(2,4,5)
If it works well i will share the code, but for now here’s a taste!
Has anyone already done this btw?
@Jaybob I don’t think anyone has attempted a generalised 3D physics engine before. Impressive work!
@Jaybob - I think the real test is with collisions, when you have to work out deflection angles and rotation (in 3D) for different shapes. The reason Box2D is not Box3D is most likely due to the complexity of collisions, which are difficult enough in 2D.
In your video, the spinning that occurs on collisions seems to be fairly standard - is it based on actual forces, or a fixed animation?
Wow! I’ve never seen something SOOOOOO unique. Very impressive. All I can say now is, dude, YOU, ARE, A, CODE, HOG.
Looks great. Your 3D work is very impressive.
@Ignatz yeah the rotation is a fixed amount, it needs to account for velocity mass and friction so its just a placeholder for now, but the axis is relative to the collision, also has angularDamping on.
@Jaybob - very impressive. How many faces do your spheres have?
It’s been an age since I’ve done any serious work with collisions in 3D I’m guessing you’re starting with spheres as the maths and bounding boxes are all circles and you can (in theory) ignore orientation etc
@Jaybob - it’s a brave attempt, but judging by the expert views I’ve read on this (because I looked at this once), accurate 3D collisions and rotations are hellishly difficult. Good luck with the next step!
@TechDojo 400 faces i think, but as you guessed im using bouding spheres
so all the is needed for a collision is the radius