Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Col detect.

  1. #1
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Col detect.

    Can someone please shed some light on collision detection. I get my collision detected but the way I do it is with physicall coordinates, and obviously thats crap. Basically to start off with how do you determine that the camera has colided with a polygon?

  2. #2
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    Blagoevgrad,Bulgaria
    Posts
    18

    Re: Col detect.

    Hi!
    This is not answer. I want to ask you about the moving. I don't want to move the whole scene. I want to move only one object among the others. When I use glTranslatef the whole scene is moving.

  3. #3
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Col detect.

    Hehehe, OK thats easy.
    glPushMatrix();
    glTranslatef(whatever);
    glBegin(WHAT_EVER);
    //
    ...
    ...
    ...
    //
    glEnd();
    glPopMatrix();
    By doing this you are only translating the current matrix. If glTranslatef() is within the push/pop matrix, it doesn't effect the rest of the scene. Hope it helps.

  4. #4
    Junior Member Newbie
    Join Date
    Jun 2001
    Location
    Blagoevgrad,Bulgaria
    Posts
    18

    Re: Col detect.

    Oh,Thank you!
    Now I understand, at last. It is good that there are such good people like you in this forum. They help to the beginners like me.

  5. #5
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Col detect.

    Hehe, thanks but I'm pretty much a begginer myself.

  6. #6
    Senior Member Regular Contributor
    Join Date
    Apr 2011
    Posts
    288

    Re: Col detect.

    You meant camera as a point, or the view volume defined by the camera's clipping planes?

  7. #7
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Col detect.

    Well lets take a first person perspective.
    How do you know when you walk into a wall. I know about the sphere thing, but don't understand it all that well yet. So I mean camera as in explained here.

  8. #8
    Senior Member Regular Contributor
    Join Date
    Oct 2005
    Posts
    137

    Re: Col detect.

    From what I understand... he's talking about the camera as a point...

    You can try using something like portals and BSP trees to minimize the checks needed for collision detection. They greatly reduce the amount of unnecessary checks for collision. Then maybe you could try to check for collision with only those walls that are in front of you (through BSP trees).

    If you dont want to do that much work then a simple hack is ...

    when drawing a vertical wall ( in the main draw loop ) check your existing point and the points of the wall. If your point is within boundaries of the wall then check your points normal of the direction that your moving in. compare it with the normal of the wall ( which should be pre calculated ) and if they are opposite then stop movement.

    ... this may not be a very efficient approach but you can make it more efficient by using BSP trees. Also you can add other checks if the wall in front is of a certain height then you can climb over it etc.

    Hope this helps....


    Fastian

    "It is better to know OpenGL then to keep thinking which 3D API to start with "

  9. #9
    Member Contributor
    Join Date
    Jul 2001
    Location
    South Africa
    Posts
    52

    Re: Col detect.

    Aaaah cool.
    Thats actaully a good idea!
    I started looking at BSP, but sheeesh, it's gonna take me a while to know it. And this is only for a small demonstration, so that other method should work cool

  10. #10
    Senior Member OpenGL Pro
    Join Date
    Jun 2000
    Location
    Shreveport, LA, USA
    Posts
    1,502

    Re: Col detect.

    Easy, most first person perspective games implement some form of collision map. The collision map (either explicitly or procedurally) which is derived from the architectural map. The collsion map is nothing more than a set of plane segments that define the boundaries of solid (or rather blocking) objects. You simply check your new position against the collision map to see if it is allowed. And if its not, you clip the movement by the plane that is blocking the motion. The tricky part is determining which planes to test as you don't want to test all planes. You need to test only those planes that would have a chance of blocking you.

Page 1 of 2 12 LastLast

Similar Threads

  1. How to detect that a GPU can have an RGB FBO?
    By kturkowski in forum OpenGL ES
    Replies: 0
    Last Post: 11-19-2013, 05:46 PM
  2. Detect SM 4.0 in the shader?
    By Leadwerks in forum OpenGL: GLSL
    Replies: 1
    Last Post: 04-01-2008, 03:12 PM
  3. Detect modifier key(s) without polling
    By Granium in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-02-2006, 12:37 PM
  4. how to detect glx errors?
    By cem polat in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 09-07-2004, 01:46 AM
  5. Collision detect
    By NeckCracker in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 06-13-2000, 02:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean