// matrix for build wall
short matrix[]={1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,
1,0,1,0,0,0,1,1,0,0,0,0,1,0,1,1,1,1,1,1,
1,0,1,0,1,1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,
1,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,
1,0,1,0,1,1,1,0,0,0,0,0,0,1,0,1,0,0,0,1,
1,0,1,0,0,1,0,0,1,0,1,1,0,1,0,1,0,1,0,1,
1,0,0,1,0,1,1,0,1,0,0,1,0,1,0,0,0,0,0,1,
1,0,1,0,0,0,0,0,1,0,1,1,1,1,1,1,0,1,0,1,
1,0,0,1,0,1,0,1,1,0,1,1,0,0,0,0,0,1,0,1,
1,1,0,1,0,1,0,1,0,1,0,0,0,1,1,1,1,1,0,1,
1,0,0,1,0,1,0,1,0,1,1,1,0,1,0,0,1,0,0,1,
1,1,0,1,0,1,1,1,0,0,0,0,0,1,0,1,1,0,1,1,
1,0,0,1,0,1,1,1,1,1,1,1,0,1,0,0,0,0,0,1,
1,0,1,0,0,0,0,0,0,0,0,1,0,1,0,1,1,1,1,1,
1,0,1,0,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,1,
1,0,1,0,1,0,1,1,1,1,1,1,0,1,0,1,0,0,0,1,
1,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,1,0,1,
1,1,1,0,0,0,1,1,1,1,0,0,0,1,0,0,0,1,0,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,};
case GLUT_KEY_LEFT :
Array[0].rotY+= 5.0; break;
case GLUT_KEY_RIGHT :
Array[0].rotY-= 5.0; break;
my up key :
Array[0].X -= (float)sin(Array[0].rotY * PI/180) * 0.15;
Array[0].Z -= (float)cos(Array[0].rotY * PI/180) * 0.15;
my down key :
Array[0].X += (float)sin(Array[0].rotY * PI/180) * 0.15;
Array[0].Z += (float)cos(Array[0].rotY * PI/180) * 0.15;
How to code the collision detection for my UP and DOWN key ? please give me the code for my collision detection . thanks