Hi..
I'm trying to make a FPS game but I have a problem :
I made a map with many houses and then put player1 (computer player) behind one of these houses and my player (player2) in a opposite side of that house .
the player1 directly shoot on my player .
how can I make the Computer player don't shoot at my player unless he see him with out any barrier

I tried this way :
I Put GLcube and made it touch my player ,then I made a collision Check if the GLcube collision with map that mean the computer player can't see my player (because GLcube collision with the house )
unless he can see me.
but I don't know why the "DistanceTo" procedure gives wrong value to the CubeDepth.
so I found the Cubedepth not reach to my player and stop it continues about "215" more than it has to be

the code I used :
// GLCube1 in the Player1 //
Player1.PointTo(Player2, YHmgVector);
GLCube1.CubeDepth := Player1.DistanceTo(Player2);
GLCube1.Position.Z := GLCube1.CubeDepth/2;

please if there any another idea or why the code not work tell me about it.
note : I tried that code before and it's work very well but I don't know now why it doesn't work
thanks a lot