We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I'm working on a ball bounce system, but having trouble calculating the angle for each.
I'd prefer not to use the Vector class because I'd like to do a more hands-on approach.
Each object of class Ball has an X and Y velocity, as well as an X and Y position. What's the best way to make two balls bounce off each other at any angle with only two sets of velocities?
Thanks
Answers
https://forum.Processing.org/two/discussion/14805/collision-detection-of-object-works-but-not-always
Well, I have the BouncingBalls sketch, but I don't really understand this method. I'm assuming its reflecting the incoming angle across a normal angle or something similar, but I'd like to know the methods its actually using.
http://www.openprocessing.org/sketch/305960
Well, I've made something that works using that method. However, when the balls bounce apart they seem to produce new velocity, sort of like a negative friction, so the balls never actually slow down.
e.g. if two balls slowly roll into each other they will rocket apart upon touching. Anyone know how to slow it down?
You can try to add a coefficient that would decrease your speedx and speedy, now, these are just inverted, so they bounce with the same speed they were aproaching each other.