Archived

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

nanobyte

Newbie Collision Detection

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