Thanks for the link Reup. I will check it out.
I have written some code for a bounce on a straight wall. What I do is split the velocity in two part. The part parallel to the wall and the part perpendicular to the wall. Then I reverse the part perpendicular to the wall and I combine them to the true velocity. I know it's not perfect as this code generates a 100% perfect bounce. without any loss of energy, but for now it'll do.
I can also use it for a bounce against an arc but the ball can get stuck for a while in some rare cases.
Next up: adding gravity and friction
|