This function is used to trace from one position to another in the BSP tree and store the results in a trace_t structure.
This is useful for temporarily deleting an entity or when performing major alterations to an entity's fields. Unlinking an entity that is already unlinked has no effect.
The results consist of the following information (where tr is a variable of type trace_t):
- tr.allsolid: if this is qtrue then the area (or some part of it) between the mins and maxs is inside a solid (a brush).
- tr.contents: the contents mask of the plane that the trace hit.
- tr.endpos: position where the trace ended.
- tr.entityNum: entity number of the entity that the trace hit (if it hit solid geometry then this will equal ENTITYNUM_WORLD).
- tr.fraction: this is the fraction of the vector between start and end where the trace ended. Therefore if this is less than 1.0 the trace hit something.
- tr.plane: contains information about the plane that was hit (most notably the surface normal) stored in a cplane_t structure.
- tr.startsolid: if this is qtrue then the trace started in a solid (brush).
- tr.surfaceFlags: surfaceflags of the surface that was hit (look in surfaceflags.h at the SURF_* constants to see the which ones there are).
If the mins and maxs are NULL then the trace is treated as purely linear from point to point.
If mins and maxs are defined however a bounding box trace is performed whereby rather than a point the entire bounding box is traced so that it is possible to detect the collision between solid entities. For example, tracing directly downwards onto a floor with mins and maxs set to { -15, -15, -15 } and { 15, 15, 15 } respectively starting at some point above the floor will result in a trace_t with an endpoint 15 units from the floor.