Archived

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.

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

1. 1
Rutin
44
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632983
• Total Posts
3009714
• Who's Online (See full list)

There are no registered users currently online

×