Game Development Community

PlayerData::onTargetEnterLOS

by Dave · in Torque Game Engine Advanced · 01/25/2006 (8:24 am) · 3 replies

Can anybody tell me if PlayerData::onTargetEnterLOS works correctly in TSE? My player always seems to be in the LOS whether he's behind blocks, rocks or on the other side of an Atlas hill!

I'm trying to meld the AI tutorial with some other stuff I've found on the forums. The relevant code I have is

Bob.aimAt($player);

function PlayerData::onTargetEnterLOS(%this, %obj){

echo("****** Entered Los: " @ %this @ " : " @ %obj @ " *******");

if(!isObject(%obj)){
return;
}

echo("****** Setting trigger *******");
%obj.setImageTrigger(0, true);
}

The bot (Bob) aims at my player and blasts him even when hidden. Any ideas much appreciated.

Thanks,

Dave.

#1
01/26/2006 (5:42 am)
Hmmm, seems to be working with square objects and terrain, but not with oddly shaped objects like big rocks.

The reason I thought it wasn't working with terrain before was that I didn't have an "on exit LOS" set up, and my player was being spotted by the bot as it dropped down to the ground after spawning. So it started shooting and never stopped as there was no exit LOS function called.

Just updating this in case it helps someone else some time. Still haven't figured out why the odd shapes don't hide the player though.
#2
01/29/2006 (9:48 am)
Have you used showtool pro to look at the collision boxes? I don't know how accurate they are.. there where some old posts you might search up.
#3
02/22/2006 (6:51 am)
Thanks Randy. Sorry to bump this by replying, but I didn't want to seem rude by ignoring it. I hadn't checked this thread for a few weeks. I think it's to do with overhanging shapes. It works fine for all co-planar objects, it's weird twisted shapes that seem to mess it up.