# The Industry's Foundation for High Performance Graphics

1. ## Circular collision detection

I have a program with trees that require me to calculate for collision detection. I can get how to detect if I'm touching the tree, but my problem is to make it so if I try to move even at an angle I don't get stuck. I am trying to make it so you would be able to run along a row of trees while looking at them like in games. Does anybody have any ideas?

2. ## Re: Circular collision detection

You could treat the tree like a wall which is perpendicular to the tree's vector relative to the camera. Then slide the camera against that wall like I'm doing in my example I posted.

http://www.opengl.org/discussion_boa...c;f=6;t=000475

That's what I'm planning to do.

3. ## Re: Circular collision detection

Ok, sounds great, but I don't know how to implement that. I have something that seems it could work, but I can't figure out how I could get it to work. Here is the code that I find might have some potential. Note: this code was meant for particles to face the cam at all time.

Code :
```GLfloat matrix[16];
glGetFloatv( GL_MODELVIEW_MATRIX, matrix );
vector3_t right( matrix[0], matrix[4], matrix[8] );
vector3_t up( matrix[1], matrix[5], matrix[9] );

vector3_t p( x,y,z );

//Now create each particle:
glTexCoord2f( 0.0f, 0.0f );
glVertex3fv( (p + (right + up ) * -size ).v );
glTexCoord2f( 1.0f, 0.0f );
glVertex3fv( (p + (right - up ) * size ).v );
glTexCoord2f( 1.0f, 1.0f );
glVertex3fv( (p + (right + up ) * size ).v );
glTexCoord2f( 0.0f, 1.0f );
glVertex3fv( (p + ( up - right ) * size ).v );
glEnd();```
I'm not that great with vertex pointers I just prefer to define the x, y, and z points of each vertex

#### Posting Permissions

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