-
Notifications
You must be signed in to change notification settings - Fork 1
FTrace
Tracers with hit and ray configuration. The difference with wire rangers
is that this is a dedicated class being initialized once and used as many
times as it is needed, not creating an instance on every E2 tick and later
wipe that instance out. It can extract every aspect of the trace result structure returned and
it can be sampled locally ( origin
and direction
relative to
entity
or pos
/dir
/ang
) or globally ( entity
is not available and pos
/dir
/ang
are treated world-space data ). Also, it has better performance than the regular wire rangers.
The FTrace
class consists of fast performing traces object-oriented
instance that is designed to be @persist
and initialized in expression
first() || dupefinished()
. That way you create the tracer instance once
and you can use it as many times as you need, without creating a new one.
wire_expression2_ftrace_skip > Contains trace generator blacklisted methods ( ex. GetSkin/GetModel/IsVehicle )
wire_expression2_ftrace_only > Contains trace generator whitelisted methods ( ex. GetSkin/GetModel/IsVehicle )
wire_expression2_ftrace_dprn > Stores the default status output messages streaming destination
wire_expression2_ftrace_enst > Contains flag that enables status output messages
You can create a trace object by calling one of the dedicated creators newFTrace
below
whenever you prefer to attach it to an entity or you prefer not to use the feature.
When sampled locally, it will use the attachment entity to orient its direction
and length in pure Lua. You can also call the class constructor
without an entity to make it world-space based. Remember that negating the trace length will
result in negating the trace direction. That is used because the trace length must always be positive so
the direction is reversed instead.
There are currently three types of trace filters in Garry's mod that you can put in the
trace data
.filter
value. Utilizing the method getFilterMode
will return the
current tracer filter operation mode. The filter configuration is NIL
by default
-
Entity reference directly written to the filter. This entity is skipped by the trace
This filter mode is activated by utilizing thesetFilterEnt
method byEnt
asentity
-
Entity sequential table ( array ) in the filter. Every item is skipped by the trace
This filter mode is activated by utilizing thesetFilterEar
method byEar
asentity array
-
Finction callback routine. This is slower but the most uiversal method available
This filter mode is activated by utilizing thesetFilterFnc
method byFnc
asfunction
- User can also clear the filter entierly by utilizing the
remFilter
method
The internal type of the class is xft
and internal expression type ftrace
, so to create
a tracer instance you can take a look at the example.
The description of the API is provided in the table below.
Instance creator | Out | Description |
---|---|---|
newFTrace () |
Returns flash trace relative to the world by zero origin position , up direction vector and direction length distance
|
|
newFTrace () |
Returns flash trace relative to the world by zero origin position , up direction vector and length distance
|
|
newFTrace () |
Returns flash trace relative to the world by origin position , up direction vector and direction length distance
|
|
newFTrace (,) |
Returns flash trace relative to the world by origin position , up direction vector and length distance
|
|
newFTrace (,) |
Returns flash trace relative to the world by origin position , direction vector and direction length distance
|
|
newFTrace (,,) |
Returns flash trace relative to the world by origin position , direction vector , length distance
|
|
noFTrace () |
Returns invalid flash trace object |
Class methods | Out | Description |
---|---|---|
:dumpItem () |
Dumps the flash trace to the chat area by number identifier |
|
:dumpItem () |
Dumps the flash trace to the chat area by string identifier |
|
:dumpItem (,) |
Dumps the flash trace by number identifier in the specified area by first argument |
|
:dumpItem (,) |
Dumps the flash trace by string identifier in the specified area by first argument |
|
:getBase () |
Returns the flash trace base attachment entity if available |
|
:getChip () |
Returns the flash trace auto-assigned expression chip entity
|
|
:getCollideGroup () |
Returns flash trace trace collision group enums COLLISION_GROUP
|
|
:getCopy () |
Returns flash trace copy instance of the current object |
|
:getCopy () |
Returns flash trace copy instance of the current object with other entity
|
|
:getCopy (,) |
Returns flash trace copy instance of the current object with other entity and length
|
|
:getCopy (,) |
Returns flash trace copy instance of the current object with other entity and origin
|
|
:getCopy (,,) |
Returns flash trace copy instance of the current object with other entity , origin and length
|
|
:getCopy (,,) |
Returns flash trace copy instance of the current object with other entity , origin and direction
|
|
:getCopy (,,,) |
Returns flash trace copy instance of the current object with other entity , origin , direction and length
|
|
:getCopy () |
Returns flash trace copy instance of the current object with other length
|
|
:getCopy () |
Returns flash trace copy instance of the current object with other origin
|
|
:getCopy (,) |
Returns flash trace copy instance of the current object with other origin and length
|
|
:getCopy (,) |
Returns flash trace copy instance of the current object with other origin and direction
|
|
:getCopy (,,) |
Returns flash trace copy instance of the current object with other origin , direction and length
|
|
:getDir () |
Returns flash trace direction vector
|
|
:getDirLocal () |
Returns flash trace world direction vector converted to base attachment entity local axis |
|
:getDirLocal () |
Returns flash trace world direction vector converted to angle local axis |
|
:getDirLocal () |
Returns flash trace world direction vector converted to entity local axis |
|
:getDirWorld () |
Returns flash trace local direction vector converted to base attachment entity world axis |
|
:getDirWorld () |
Returns flash trace local direction vector converted to angle world axis |
|
:getDirWorld () |
Returns flash trace local direction vector converted to entity world axis |
|
:getDisplaceFlags () |
Returns the flash trace trace-result DispFlags DISPSURF bitmask
|
|
:getEar () |
Returns the configuration used by the entity array filter |
|
:getEarID () |
Returns the configuration used by the entity array filter as ID indices |
|
:getEarSZ () |
Returns the flash trace entity filter array size |
|
:getEntity () |
Returns the flash trace trace-result Entity entity
|
|
:getFilterMode () |
Returns flash tracer filter working mode | |
:getFraction () |
Returns the flash trace trace-result Fraction in the interval [0-1] number
|
|
:getFractionLS () |
Returns the flash trace trace-result FractionLeftSolid in the interval [0-1] number
|
|
:getFractionLen () |
Returns the flash trace trace-result Fraction multiplied by its length distance number
|
|
:getFractionLenLS () |
Returns the flash trace trace-result FractionLeftSolid multiplied by its length distance number
|
|
:getHitBox () |
Returns the flash trace trace-result HitBox number
|
|
:getHitContents () |
Returns the flash trace trace-result hit surface Contents CONTENTS bitmask
|
|
:getHitGroup () |
Returns the flash trace trace-result HitGroup group ID number
|
|
:getHitNormal () |
Returns flash trace trace-result surface HitNormal vector
|
|
:getHitPos () |
Returns the flash trace trace-result HitPos location vector
|
|
:getHitTexture () |
Returns the flash trace trace-result HitTexture string
|
|
:getLen () |
Returns flash trace length distance
|
|
:getMask () |
Returns flash trace trace hit mask enums MASK
|
|
:getMatType () |
Returns the flash trace trace-result MatType material type number
|
|
:getNormal () |
Returns the flash trace trace-result Normal aim vector
|
|
:getPhysicsBoneID () |
Returns the flash trace trace-result PhysicsBone ID number
|
|
:getPlayer () |
Returns the flash trace auto-assigned expression chip player |
|
:getPos () |
Returns flash trace origin position
|
|
:getPosLocal () |
Returns flash trace world origin position converted to base attachment entity local axis |
|
:getPosLocal () |
Returns flash trace world origin position converted to entity local axis |
|
:getPosLocal (,) |
Returns flash trace world origin position converted to position /angle local axis |
|
:getPosWorld () |
Returns flash trace local origin position converted to base attachment entity world axis |
|
:getPosWorld () |
Returns flash trace local origin position converted to entity world axis |
|
:getPosWorld (,) |
Returns flash trace local origin position converted to position /angle world axis |
|
:getStart () |
Returns flash trace trace start position sent to trace-line
|
|
:getStartPos () |
Returns the flash trace trace-result StartPos vector
|
|
:getStop () |
Returns flash trace trace stop position sent to trace-line
|
|
:getSurfPropsID () |
Returns the flash trace trace-result SurfaceProps ID type number
|
|
:getSurfPropsName () |
Returns the flash trace trace-result SurfaceProps ID type name string
|
|
:getSurfaceFlags () |
Returns the flash trace trace-result SurfaceFlags SURF bitmask
|
|
:insEar () |
Inserts the entity in the filter list |
|
:insEar () |
Inserts the entities from the array in the filter list |
|
:insEar () |
Inserts the entities from the table in the filter list |
|
:insEarID () |
Inserts the entity ID in the filter list |
|
:insEarID () |
Inserts the entity ID from the array in the filter list |
|
:insEarID () |
Inserts the entity ID from the table in the filter list |
|
:insFncOnly (,) |
Inserts the option to the flash trace internal hit only list |
|
:insFncOnly (,) |
Inserts the option to the flash trace internal hit only list |
|
:insFncOnlyEnt () |
Inserts the entity to the flash trace internal only hit list |
|
:insFncSkip (,) |
Inserts the option to the flash trace internal ignore hit list |
|
:insFncSkip (,) |
Inserts the option to the flash trace internal ignore hit list |
|
:insFncSkipEnt () |
Inserts the entity to the flash trace internal ignore hit list |
|
:isAllSolid () |
Returns the flash trace trace-result AllSolid flag |
|
:isHit () |
Returns the flash trace trace-result Hit flag |
|
:isHitNoDraw () |
Returns the flash trace trace-result HitNoDraw flag |
|
:isHitNonWorld () |
Returns the flash trace trace-result HitNonWorld flag |
|
:isHitSky () |
Returns the flash trace trace-result HitSky flag |
|
:isHitWorld () |
Returns the flash trace trace-result HitWorld flag |
|
:isIgnoreWorld () |
Returns the flash trace trace IgnoreWorld flag |
|
:isStartSolid () |
Returns the flash trace trace-result StartSolid flag |
|
:rayAim (,,) |
Aims the flash trace ray at a given position using three numbers
|
|
:rayAim () |
Aims the flash trace ray at a given position using a vector
|
|
:rayAmend (,,) |
Amends the flash trace ray direction using three numbers
|
|
:rayAmend () |
Amends the flash trace ray direction using a vector
|
|
:rayAmend (,) |
Amends the flash trace ray direction using vector and magnitude
|
|
:rayDiv () |
Contracts the flash trace ray with a number
|
|
:rayDiv (,,) |
Contracts the flash trace ray each component individually using three numbers
|
|
:rayDiv () |
Contracts the flash trace ray each component individually using a vector
|
|
:rayMove () |
Moves the flash trace ray with its own direction and magnitude
|
|
:rayMove () |
Moves the flash trace ray with its own direction and magnitude length
|
|
:rayMove (,,) |
Moves the flash trace ray with displacement as three numbers
|
|
:rayMove () |
Moves the flash trace ray with displacement vector
|
|
:rayMove (,) |
Moves the flash trace ray with direction vector , magnitude length
|
|
:rayMul () |
Expands the flash trace ray with a number
|
|
:rayMul (,,) |
Expands the flash trace ray each component individually using three numbers
|
|
:rayMul () |
Expands the flash trace ray each component individually using a vector
|
|
:remBase () |
Removes the base attachment entity of the flash trace
|
|
:remEar () |
Removes all entities from the filter list |
|
:remEar () |
Removes the specified entity from the filter list |
|
:remEarID () |
Removes the specified entity by ID from the filter list |
|
:remEarN () |
Removes an entity using the specified sequential number
|
|
:remFilter () |
Removes the filter from the trace configuration |
|
:remFnc () |
Removes all the options from the flash trace internal hit preferences |
|
:remFnc () |
Removes the option from the flash trace internal hit preferences |
|
:remFncEnt () |
Removes all the entities from the flash trace internal hit list |
|
:remFncOnly (,) |
Removes the option from the flash trace internal only hit list |
|
:remFncOnly (,) |
Removes the option from the flash trace internal only hit list |
|
:remFncOnlyEnt () |
Removes all the entities from the flash trace internal only hit list |
|
:remFncOnlyEnt () |
Removes the entity from the flash trace internal only hit list |
|
:remFncSkip (,) |
Removes the option from the flash trace internal ignore hit list |
|
:remFncSkip (,) |
Removes the option from the flash trace internal ignore hit list |
|
:remFncSkipEnt () |
Removes all the entities from the flash trace internal ignore hit list |
|
:remFncSkipEnt () |
Removes the entity from the flash trace internal ignore hit list |
|
:setBase () |
Updates the flash trace base attachment entity
|
|
:setCollideGroup () |
Updates flash trace trace collision group enums COLLISION_GROUP
|
|
:setDir (,,) |
Updates the flash trace direction using three numbers
|
|
:setDir () |
Updates the flash trace direction using an array
|
|
:setDir () |
Updates the flash trace direction using a vector
|
|
:setFilterEar () |
Changes the filtering mode to entity array
|
|
:setFilterEnt () |
Changes the filtering mode to entity object |
|
:setFilterFnc () |
Changes the filtering mode to function routine |
|
:setIsIgnoreWorld () |
Updates the flash trace trace IgnoreWorld flag |
|
:setLen () |
Updates flash trace length distance
|
|
:setMask () |
Updates flash trace trace hit mask enums MASK
|
|
:setPos (,,) |
Updates the flash trace origin position using three numbers
|
|
:setPos () |
Updates the flash trace origin position using an array
|
|
:setPos () |
Updates the flash trace origin position using a vector
|
|
:smpLocal () |
Samples the flash trace and updates the trace-result by base attachment entity local axis |
|
:smpLocal () |
Samples the flash trace and updates the trace-result by base position , angle
|
|
:smpLocal () |
Samples the flash trace and updates the trace-result by entity position and forward vectors
|
|
:smpLocal (,) |
Samples the flash trace and updates the trace-result by entity position , angle
|
|
:smpLocal (,) |
Samples the flash trace and updates the trace-result by position , entity angle
|
|
:smpLocal () |
Samples the flash trace and updates the trace-result by position , base angle
|
|
:smpLocal (,) |
Samples the flash trace and updates the trace-result by position , angle
|
|
:smpWorld () |
Samples the flash trace and updates the trace-result by the world axis |
|
:smpWorld () |
Samples the flash trace and updates the trace-result by entity position and angle forward |
|
:smpWorld () |
Samples the flash trace and updates the trace-result by entity position and forward vectors
|
|
:smpWorld (,) |
Samples the flash trace and updates the trace-result by entity position , angle
|
|
:smpWorld (,) |
Samples the flash trace and updates the trace-result by position , entity angle
|
|
:smpWorld () |
Samples the flash trace and updates the trace-result by position vector and entity forward |
|
:smpWorld (,) |
Samples the flash trace and updates the trace-result by position , angle
|
|
:updEarSZ () |
Performs flash trace entity array filter list refresh |
General functions | Out | Description |
---|---|---|
:setFTrace () |
Returns flash trace relative to the entity by zero origin position , up direction vector and direction length distance
|
|
:setFTrace () |
Returns flash trace relative to the entity by zero origin position , up direction vector and length distance
|
|
:setFTrace () |
Returns flash trace relative to the entity by origin position , up direction vector and direction length distance
|
|
:setFTrace (,) |
Returns flash trace relative to the entity by origin position , up direction vector and length distance
|
|
:setFTrace (,) |
Returns flash trace relative to the entity by origin position , direction vector and direction length distance
|
|
:setFTrace (,,) |
Returns flash trace relative to the entity by origin position , direction vector , length distance
|