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.

DarkBASIC Discussion / 3d pong toubles(i know,pathetic...)

Author
Message
Bishop
22
Years of Service
User Offline
Joined: 18th Dec 2002
Location: In my favorite chair...
Posted: 25th Feb 2003 05:11
I want to make a 3d pong, but when I try to make the ball bounce off when it hits a wall, how do I do it? I can't have it reverse tiself every time it hits a wall. Any help would be cool...

Bishop
"When you were born, you cried and the world rejoiced. Live so when you die, the world cries and you rejoice."
The Darthster
22
Years of Service
User Offline
Joined: 25th Sep 2002
Location: United Kingdom
Posted: 25th Feb 2003 18:32
You don't need to reverse the whole ball, just it's speed. You should be using variables to hold both the x and y (and z possibly) velocity and position of the ball. To make it easy for yourself you should be using axis aligned walls to bounce the ball off, so you just need to reverse the velocity in the direction of the wall from the ball. For example, if the ball is moving to the right towards a vertical wall, the direction from the ball to the wall is along the x axis, so you reverse the x velocity when it bounces.

Once I was but the learner,
now, I am the Master.

Login to post a reply

Server time is: 2025-05-15 12:50:57
Your offset time is: 2025-05-15 12:50:57