caseybetts / GravIt_Space-Game

A fun space game where you can grow your gravitational influence
0 stars 0 forks source link

Conservation of momentum #17

Open caseybetts opened 2 years ago

caseybetts commented 2 years ago

When the player collides with a space rock momentum should be conserved.

Within the collision block, calculate the momentum of the player and the rock and adjust the player velocity to keep the total momentum constant.

p_t = p_p + p_r = mv + mv => v_p = (p_t - m*v)/m

caseybetts commented 2 years ago

This has been implemented, but needs testing. I'm not convinced that it's working correctly.