Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Making a bal bounce off walls

Author
Message
Nithead
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Hampshire, England
Posted: 11th Mar 2009 19:53
Firstly, i know ive already asked this but the tread seems to have gone dead.

Anyway part of the program i'm writing is supposed to make a ball bounce off when it collides with a wall. A formula I found seems to work perfectly for the two horizontal walls, but weirdly and unpredictably for the verticle walls.





True geeks live forever, or die trying.
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 11th Mar 2009 20:48 Edited at: 11th Mar 2009 20:49
Form what I see in the code you are looking down on the objects so the wall are left -x right +x and (top of screen) back +z (bottom of screen) front -z.

does that help.

Dark Physics makes any hot drink go cold.
Nithead
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Hampshire, England
Posted: 11th Mar 2009 22:12
how do i add that to my code?

True geeks live forever, or die trying.
Nithead
15
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Hampshire, England
Posted: 12th Mar 2009 00:26
hang on i was aproaching it wrong, i needed to think of it in terms of velocity rather than angle:



True geeks live forever, or die trying.

Login to post a reply

Server time is: 2024-11-25 17:52:17
Your offset time is: 2024-11-25 17:52:17