Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: ortho projections in games

  1. #1
    Intern Contributor
    Join Date
    Jan 2002
    Posts
    52

    ortho projections in games

    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:

    Code :
    		//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

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Jul 2001
    Posts
    533

    Re: ortho projections in games

    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).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •