Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

nanobyte

Newbie Collision Detection

This topic is 6208 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am now writing simple programs in Directx8 and I need to know how to do simple collision detection. For example, the polygons I render to the screen are drawn using the 3d coord system and not specific pixel values. I have written a simple pong game, but it uses a custom integer value for the x & y and when the user presses the right & left keys, this value is added to or substracted. Then I use a function like the following: void DetectCollision() { float minnum = paddle_x; float maxnum = paddle_x + 1.4; if( (ball_x > minnum) && (ball_x < maxnum)) { if(ball_y < -3.8 ) { dy = dy + 0.001; // do whatever when collision } } There has to be a better way! Do I have the completely wrong idea in the above implementation or what??? Any web sites to help out w/ collision in d3d? Thanks

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!