# comp.graphics.algorithms

## Subject: Re: Collision Detection in Maze

Please forgive me for my english.

> And what is the shape of "one" you're trying to move around?

Actually here walking means moving the "camera" forward, backwark,
or rotating it left, right. There is no "3D model". Usually u presses
the 'A','S'.'W','D'keys to stroll in the maze. I am not sure whether i
explain it clearly.

> but mine is 3D and the wall is one-pixel width.
Yes, maybe the way i describe it is not exact. Below is the my drawing
maze's code.
Actually the wall is plane, its depth unit is 1.

glBindTexture(GL_TEXTURE_2D,textureid[2]); //the
texture for the maze wall
for(int i=0;imaze array
{
for(int j=0;j {
if(maze[i][j].up == 1) //The up direction has a wall. Then use
the texture.
{
glTexCoord2f(0.0,0.0);
glVertex3f(j*inteval,0.0,i*inteval);
glTexCoord2f(2.0,0.0);
glVertex3f( (j+1)*inteval,0.0,i*inteval);
glTexCoord2f(2.0,1.0);
glVertex3f( (j+1)*inteval,roomHeight,i*inteval);
glTexCoord2f(0.0,1.0);
glVertex3f(j*inteval,roomHeight,i*inteval);
}

if(maze[i][j].down == 1)
{
glTexCoord2f(0.0,0.0);
glVertex3f( j*inteval,0.0,(i+1)*inteval);
glTexCoord2f(2.0,0.0);
glVertex3f( (j+1)*inteval,0.0,(i+1)*inteval);
glTexCoord2f(2.0,1.0);
glVertex3f( (j+1)*inteval,roomHeight,(i+1)*inteval);
glTexCoord2f(0.0,1.0);
glVertex3f( j*inteval,roomHeight,(i+1)*inteval);
}

if(maze[i][j].left == 1)
{
glTexCoord2f(0.0,0.0);
glVertex3f( j*inteval,0.0,i*inteval);
glTexCoord2f(0.0,1.0);
glVertex3f( j*inteval,0.0,(i+1)*inteval);
glTexCoord2f(2.0,1.0);
glVertex3f( j*inteval,roomHeight,(i+1)*inteval);
glTexCoord2f(2.0,0.0);
glVertex3f( j*inteval,roomHeight,i*inteval);
}

if(maze[i][j].right == 1)
{
glTexCoord2f(0.0,0.0);
glVertex3f( (j+1)*inteval,0.0,i*inteval);
glTexCoord2f(0.0,1.0);
glVertex3f( (j+1)*inteval,0.0,(i+1)*inteval);
glTexCoord2f(2.0,1.0);
glVertex3f( (j+1)*inteval,roomHeight,(i+1)*inteval);
glTexCoord2f(2.0,0.0);
glVertex3f( (j+1)*inteval,roomHeight,i*inteval);
}
}
}
glEnd();