AlliedModders

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

ts2do 09-21-2004 18:27

TraceLine
 
could someone help me with traceresult and finding the flFraction

Freecode 09-21-2004 22:36

i wonder what this is for

PM 09-22-2004 09:25

as it says in eiface.h:
Code:

float        flFraction;                        // time completed, 1.0 = didn't hit anything
You can for example get the distance between the start point end the found point using Length(endPoint - startPoint) * flFraction (although its easier to do it using Length(foundPoint - startPoint) but it was meant to show you what flFraction is).

AFAIK, you can get the flFraction member of the TraceResult structure using:
Code:
new Float:flFraction; traceresult(TR_Fraction, flFraction);

ts2do 09-24-2004 23:04

and where is TR_Friction taken from, and I also heard about a global trace thing

Freecode 09-25-2004 00:00

Quote:

Originally Posted by ts2do
and where is TR_Friction taken from, and I also heard about a global trace thing

from fakemeta
so include fakemeta and check fakemeta_const all the way in the bottom.

Its always nice to look at inc's before asking simple questions

PM 09-25-2004 04:15

Quote:

Originally Posted by ts2do
and where is TR_Friction taken from, and I also heard about a global trace thing

When you do a trace, it automatically stores the results so you can read them using traceresult.

ts2do 09-25-2004 14:48

does it matter if I use trace_line or engfunc_traceline to trace?

Freecode 09-25-2004 14:54

hmm trace_line is a forward engfunc_traceline will most likely return just once

ts2do 09-25-2004 15:03

sample snippit plz

Freecode 09-25-2004 15:09

ok. the TraceLine forward gets called 10 a second if not more. so doing
Code:
register_forward(FM_TraceLine,"TraceLine",1) public TraceLine(Float:v1[3],Float:v2[3],pentToSkip,Mosnters) { //code here }
will constantly get called
but doing

Code:
public traceline(id) { new Float:v1[3] new Float:v2[3] new rid,mosnter eng_func(EngFunc_TraceLine,v1,v2,vid,mosnter); }
will call TraceLine once and gets all the info once only when you will call on public traceline(id). So everytime u need to get stuff from traceline ud have to call traceline(id);

PS. the code is off top of my head so some stuff/natives might be wrong/misspelled


All times are GMT -4. The time now is 17:20.

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