Interesting algorithm,

Do i understand what your are trying to do?

- You have 2 players position, (i guess the direction from position1 to position2 is not necesary axis aligned.

- you want to check if there is map geometry between position1 and position2,
- you define a cube from position1 to position2 and then you do a cube collision test against the map, if true then there is somthing between players.

Sounds good, but i see severals fault there,

* is this cube rectangular?, i mean the cubedepth seems is the distance between playes, but is that just for the cube z axis?, or cube width and cube height is the same as cubedepth?, if so then cube collision will return true if there is somthing around the player, like behind or to his sides, however player1 is visible to player 2.

* if the cube is width 1 and height 1 but only cubedepth is toplayer2 distance, then this only work if the cube is an object oriented box (OOB), but this line code you put: "GLCube1.Position.Z := GLCube1.CubeDepth/2;" tould me GLcube seem is a Axis aligned bounding box, (AABB) and this will only work when distance to player2 is only in the Z axis.

I am not a GLscene users, so i cant tell you exactly what GL primitive to use, but if you want to check if player1 is visible to player2 then i sugest look if there is available a sphere primitive or a raytrace or intersect utility.

*Using a sphere primitive:
- You calc a vector from position1 to position2, then normalize the vector (vector length is equal to 1)
- you do a loop and calc a new position from pos1 toward pos2 using your normalized vector, and scaled to step increment your think best, 5 units step, or 10 units step, whatever.
- Put a sphere using as center your new position and as radio what ever you thing is best, then do a sphere to map collision, if true then break the loop and return true, there is somthing between player1 and player2.
- If the loop end and you did not found any collision then there is nothing between players, (or exactly nothing that collide with your desired sized sphere)

A intersect utility is exactly what i descibed above but finer and using a ray segment.

You have to optimize your algorithms, checking a line of sight every frame could kill your permormance.





good luck.