View Full Version : ortho projections in games

05-01-2002, 04:14 AM
I need some help. My breakout clone now has some collision detection function but I dont understand how it all fits together.

I have an ortho projection( -100 to 100 in all directions ) and my paddle is specified in a class in a different file. How does the vertex data get transferred to the ortho projection? The top polygon of the paddle is defined like this:

//top face coordinates
top[ 0 ].setValues( -width/2.0, 2.0, -2.0 );
top[ 1 ].setValues( -width/2.0, 2.0, 2.0 );
top[ 2 ].setValues( width/2.0, 2.0, 2.0 );
top[ 3 ].setValues( width/2.0, 2.0, -2.0 );
flat[ 2 ].setValues( top, QUAD_POINTS );

However when I try testing for collisions, they only occur around the origin as if the polygon was defined there, when it is being drawn at the bottom of the screen. I am lost as to how to rectify this situation http://www.opengl.org/discussion_boards/ubb/frown.gif

05-01-2002, 05:40 AM
I assume you are moving your paddle about to a given position? So although you seem to have defined it around the origin, it will actually be at position x, y.

Your collision detection therefore needs to add the x, y position of the paddle to all 4 co-ordinates ( which define the paddle around the origin) before it does its test).