Page 1 of 1

sighttrace

Posted: Fri Jul 08, 2005 11:30 pm
by lizardkid
I've searched teh forums but all i can find are old topics discussing SELF keyword and such.

My question:

in g_allclasses it gives the sighttrace argument list like:

Code: Select all

sighttrace( Vector start, Vector end, [ Integer pass_entities ], [ Vector mins ], [ Vector maxs ] )
ok, it seems simple enough. now what's with this Vector mins and Vector maxs stuff? i thought it meant minimum distance from the start and the maximum distance. No, it wants a vector.

here's my current line:

Code: Select all

if(sighttrace( local.CO local.intendedDest 0 1 1024 ) == 1)
local.CO is an Actor, local.intendedDest is a position fairly close to him. i want to check if it's not behind him in a wall or something, just a free space near him. MOH gives me an error about the mins and maxs. well it fails the script at the mins but i assume it'd do the same thing about maxs.

Posted: Fri Jul 08, 2005 11:36 pm
by Bjarne BZR

Posted: Sat Jul 09, 2005 2:28 am
by lizardkid
no, not really. that example doesnt fit the arguments :S

Posted: Sat Jul 09, 2005 7:07 am
by bdbodger
All I ever seen them do is like this

if !(sighttrace ($player.origin + (0 0 50)) (local.sniper[local.i].origin + (0 0 50)) 1)

but looking at Bjarne BZR's site it says it is a bounding box that the sighttrace is done within I guess like when you make triggers etc . So I assume that something like this ( -500 -500 0)( 500 500 1000) will give you a 1000x1000x1000 box I don't know if that is from the start position or not but it maybe .

Posted: Sat Jul 09, 2005 7:16 am
by lizardkid
it looks for a bounding box? is there no way to just trace between point A and point B and check for collision? trace just returns a position, i was hoping for a collision check :(

Posted: Sat Jul 09, 2005 8:57 am
by Rookie One.pl
Yeah, mins and maxs are almost always related to bounding boxes. There's quite a lot of this stuff in ET's source. But hence these mins and maxs are just optional parameters I think you can just skip them.

Posted: Sat Jul 09, 2005 9:05 am
by jv_map
Use min and max if you want to check if an object with bounding box size defined by min and max could reach the destination. So, if you don't specify min and max you're doing a line trace, if you do specify them you're doing a box trace.

Lizard your code doesn't work because in mohaa scripting arguments aren't placed within parens () but directly after the command.

if(sighttrace( local.CO local.intendedDest 0 1 1024 ) == 1)

should be

if(sighttrace local.CO.origin local.intendedDest 1 ( -16 -16 0) (16 16 92))

or, taking into account some stepsize

if(sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 1 ( -16 -16 0) (16 16 76))

Where pass_ents is 1 so the trace won't hit local.CO. A better way to make sure the trace won't hit your bot is:

if(local.CO sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 0 ( -16 -16 0) (16 16 76))

If this doesn't help then I don't know what will :P

P.S. that means the info @ rjukan isn't correct :oops:

Posted: Sat Jul 09, 2005 9:25 am
by Bjarne BZR
jv_map wrote:P.S. that means the info @ rjukan isn't correct :oops:
Hmm... cant remember where I got the current info from, its not in g_allcalsses.html...

But if you say that is how it works, then that is how it works :) Can you make an ubdate to the example and add a correcter descrition on the wiki?

Posted: Sat Jul 09, 2005 9:34 am
by jv_map
Bjarne BZR wrote:Hmm... cant remember where I got the current info from, its not in g_allcalsses.html...
I suffixed the :oops: for a reason ;)
But if you say that is how it works, then that is how it works :) Can you make an ubdate to the example and add a correcter descrition on the wiki?
Uhhm sure :)

Posted: Sat Jul 09, 2005 9:39 am
by Bjarne BZR
jv_map wrote: I suffixed the :oops: for a reason ;)
Poking one self... one of my favourite forms of humor :)

Posted: Sat Jul 09, 2005 6:39 pm
by lizardkid

Code: Select all

if(local.CO sighttrace (local.CO.origin + (0 0 16)) (local.intendedDest + (0 0 16)) 0 ( -16 -16 0) (16 16 76)) 
Works like a charm, they run their little wandering patrols and return right back to the CO, thanks jv!