sleddog / pool

Pool by Devin Gray
http://www.devingray.com/pool
MIT License
12 stars 18 forks source link

Rubber collisions#71 #72

Closed kinnerapriyap closed 7 years ago

kinnerapriyap commented 7 years ago

Change bumper collisions to account for rubber. Add bumperBounce as preference.

sleddog commented 7 years ago

@kinnerapriyap thanks again for this PR. When I tested it, the angle of return off the bumper seemed off. Can you look into this again and reopen a new PR? I think it has to do with the math that you added:

ball.velocity.x *= -(PREFS.bumperBounce/5);

kinnerapriyap commented 7 years ago

@sleddog The angle if off because the velocity parallel to the bumper has no force on it and remains the same. The velocity perpendicular is reduced because of loss in kinetic energy due to collision. So since only one component of velocity changes, the angle changes. Do let me know if you want me to make any changes to it.