Gonkee / Gepe3D

Gonkee's Epic Physics Engine 3D (Gepe3D)
MIT License
492 stars 40 forks source link

some insights on physics of this simulation #28

Open nort3x opened 1 year ago

nort3x commented 1 year ago

physics student here

use velocity verlet method to update velocity and position it's more efficient than RK4 and it's stable (it doesn't diverge like euler method)

and the wiggly thing is expected and it's because of conservation of energy as ball drops and it gains velocity (kinetic energy) due collision the kinetic energy is transferred to your spring-mass system energy and it wiggles wildly (it's actually temperature) to cancel it out define some dispersion of energy just add a damping factor to your hook law F = ma = -k* x - d*v and it should work.