Jump to content
  • Advertisement


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


why is my collision like this??

This topic is 5743 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

hello i''m just starting to learn opengl and 3d so i figured i would make a simple pong game just to get used to moving objects in 3d the way i''m doing it is i set up a 2d ortho viewing projection using gluOrtho2d(-90, 90, -90, 90) set it MatrixMode to GL_MODELVIEW and draw my paddles and ball around the origin using GL_QUADS paddle 1 & 2 = -5.0f, 20.0f, -5.0f, -20.0f, 5.0f, -20.0f, 5.0, 20.0f so the width is 10 and the height should be 40? and the ball is draw with -5.0f, 5.0f, 5.0f, -5.0f, 5.0f, -5.0f 5.0, 5.0f so it should have a width and height of 10? i then translte them into there places now on to that actual question when i got to do my collsion dection at the top of the screen this happens i want to use this for the top of the screen pad.height i''m hoping is 40 buy the way i set up the model if( (pad.y + (pad.height / 2)) >= 90) pad.y = (90 - (pad.height / 2)); but i have to use this if((pad.y + 45) >= 90) pad.y = (90 - 45); now for at the bottom of the screen if((pad.y - (pad.height / 2)) <= -90) pad.y = (-90 + (pad.height / 2)); works fine so i''m wondering if anybody can tell me how come this happens? sorry if i put to much info but i think its better having a bunch of usles stuff then not enough...thx for any help

Share this post

Link to post
Share on other sites

  • 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!