Title says it all, I made this as a project for my AP physics class. I'm attempting to simulate realistic two-dimensional kinematics using pico-8.
Please tell me if I've gotten the math wrong anywhere :D
P#40869 2017-05-22 15:14 ( Edited 2017-05-22 19:54)
Nice! I think you're missing a 0.5*dt^2*acceleration term when updating the position:
local dt=1 obj.x+=dt*obj.vx obj.y+=0.5*dt*dt*gravaccel+dt*obj.vy obj.vy+=dt*gravaccel
If you wanted to make it work properly at different frame rates, you could also calculate the dt based on the actual time elapsed instead of assuming it's always one.
P#40871 2017-05-22 15:54 ( Edited 2017-05-22 19:54)
[Please log in to post a comment]