AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Using trace_line (https://forums.alliedmods.net/showthread.php?t=19842)

Charr 10-26-2005 15:28

Using trace_line
 
I'm trying to use trace_line to find if it hits an entity/map texture.

What does it return if it hits nothing or a map texture?

XxAvalanchexX 10-26-2005 17:22

pHit would probably be 0, and I assume that flFraction would be 1.0

Charr 10-26-2005 22:50

So I would have to use the trace_line, then the result?

I checked out the trace result on the funcwiki, but
Code:

traceresult ( type, [ ... ] )
Isn't too discriptive.

XxAvalanchexX 10-26-2005 23:05

Hmm, try this:

Code:
trace_line(...); new pHit = traceresult(TR_pHit);

Charr 10-26-2005 23:06

Will do and thanks.

Charr 10-27-2005 12:10

Wound'nt it be: ?
Code:

new pHit
trace_result(TR_pHit,phit)


XxAvalanchexX 10-27-2005 16:06

I think if there are no extra parameters it returns the value as an integer. If there are one extra parameters it sets a float by reference. If there are two extra parameters it sets a string by reference. This is the general format of FM stuff.

Freecode 10-27-2005 17:00

Quote:

Originally Posted by XxAvalanchexX
pHit would probably be 0, and I assume that flFraction would be 1.0

no it would be -1, even though proly should be 0 as 0 is world in HL engine

Code:
case TR_Hit:         if (!FNullEnt(g_tr.pHit))             return ENTINDEX(g_tr.pHit);         else             return -1;
and yes use avalanches way as it sets the var to return value by the native.


All times are GMT -4. The time now is 23:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.