Thread: Bouncing Ball
View Single Post
Old 20-02-2007, 04:17 PM   #6
nitro
Forum hobbit

 
Join Date: Jan 2007
Location: Nunspeet, Netherlands
Posts: 31
Default

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
nitro is offline                         Send a private message to nitro
Reply With Quote