Game Development Community

Visibility testing between players

by Lally Singh · in Technical Issues · 02/17/2008 (1:24 pm) · 2 replies

Hi, I'm having trouble getting a negative on a visibility test between players.

The idea is that I pass the coordinates of the other player here, and

function FS_mku_point_visible (%dest) {
%pos = FS_ku_get_eyept ();
%mask = $TypeMasks::InteriorObjectType | $TypeMasks::TerrainObjectType;
return getWordCount (containerRayCast(%pos, %dest, %mask)) == 0;
}

(where FS_ku_get_eyept() is:
function FS_ku_get_eyept () {
%connection = GameConnection::getServerConnection();
%player = %connection.getControlObject();
return %player.getEyePoint();
}
)

I seem to keep getting the same values back everytime, no matter how visible the destination point is. How can I do a proper visibility check?

Thanks in advance!

#1
02/17/2008 (2:13 pm)
This might be because containerRayCast only works on the server side,
and it looks to me like you're doing the raycast on the client side.

i would recommend modifying containerRayCast to take an additional boolean specifying whether it should use gServerContainer or gClientContainer. if you like i can post a modified version of the consoleFunction which does that, but it's very easy to do yourself.

edit:wrong "you're".
#2
02/18/2008 (3:44 pm)
Wonderful! Thank you.