Trace&Visibility API
Part of Light API
Topics
- Decals API 13
Classes
Enums
Values
BONES | tests collision geometries around bones of animated objects | |
BOX | ||
ENTS | tests entities | |
LINE | ||
NOTRACE | ||
OBB | ||
ONLY_PHYSICS | ||
PASSTRANSLUCENT | Do not intersects with entities with EntityFlags.TRANSLUCENT set | |
RAGDOLLS | tests ragdolls | |
SPHERE | ||
TRANSPARENT_OCCLUDERS | ||
VISTEST | performs visibility test first. Not necessary for entities receiving EntityEvent.VISIBLE, because there is a certainty that a camera will see them | |
WATER | tests collision with water surface | |
WORLD | tests world bounding box |
Functions
proto private void ~OcclusionQuery() | ||
proto native void Destroy() | Destroys the object | |
proto native int GetResult() | return Query result | more… |
proto native bool IsBoxVisible(vector mins, vector maxs, int flags) | tests if bbox is visible according to view-frustum and PVS | more… |
proto native int P2PVisibilityEx(vector from, vector to, int flags) | tests visibility | more… |
proto native void SetPosition(vector pos) | Sets world position | |
proto int SphereQuery(vector origin, float radius, out IEntity visents[], int ents, int fmask) | finds all entities in a radius | |
proto native bool TraceLineToEntity(IEntity ent, vector start, vector end, out TraceContact contact) | ||
proto volatile float TraceMove(TraceParam param, out IEntity cent, out float plane[4], out int surfparm, func filtercallback) | traces line start->end, return 0..1 if trace was sucessfull. // It take bboux from ent // flag like in P2PVisibilityEx will be added //OUTPUT: | more… |
proto int VisEntities(vector origin, vector look, float angle, float radius, out IEntity ents[2], int maxents, int fmask) | finds all visible entities (rought, according to a visibility. It is convinient for entitie selection where we want to do more precise visibility test) | more… |
Variables
int Content | ||
vector End | ||
IEntity Exclude | ||
TraceFlags Flags | ||
float Fraction | ||
int LayerMask = 0xffffffff | ||
vector Mat[3] | ||
int MaterialFlags | ||
owned string MaterialName | ||
vector Maxs | ||
vector Mins | ||
owned string OriginalMaterialName | ||
float Plane[4] | ||
vector Point | ||
float Radius | ||
vector Start | ||
int SurfaceID | ||
int Surfparm | ||
int Triangle |
Function Documentation
GetResultOcclusionQuery
proto native int GetResult()return Query result
Returns: -1 result is not ready yet, try it later. >0 point is visible ==0 point is not visible
IsBoxVisible
tests if bbox is visible according to view-frustum and PVS
flags- & 1 - test also PVS
Returns: true/false is/isn't visible
P2PVisibilityEx
tests visibility
fromtoflags- //TraceFlags.VISTEST - //TraceFlags.DETAIL - test agains detail brushes //TraceFlags.ENT - test against brush entities //TraceFlags.NOTRACE - doesn't test geometry (has meaning in conjuction with s TraceFlags.VISTEST)
Returns: true is visible/false not visibel
TraceMove
proto volatile float TraceMove(TraceParam param, out IEntity cent, out float plane[4], out int surfparm, func filtercallback)traces line start->end, return 0..1 if trace was sucessfull. // It take bboux from ent // flag like in P2PVisibilityEx will be added //OUTPUT:
cent- [out] traced entity
plane- [out] traced polygon plane (X,Y,Z,D)
surfparm- [out] traced surface parameters
Returns: value 0...1, percentage of a path traveled
VisEntities
proto int VisEntities(vector origin, vector look, float angle, float radius, out IEntity ents[2], int maxents, int fmask)finds all visible entities (rought, according to a visibility. It is convinient for entitie selection where we want to do more precise visibility test)
origin- - position it is looked from
look- - look direction
angle- - view angle (usuably 90). -1 if we do not care about the view angle
ents- - array to which entities will be stored
maxents- - length of the array (prevents overflowing the array)
fmask- - flag mask (SetFlags()). Entity must have all flags set. it is possible to use reserved flags like EntityFlags.USER1, EntityFlags.USER2, EntityFlags.USER6 for fast finding of entities in custom categories