traceline is a Built In function that does a raycast in the world. Although traceline collides with entities, it will not find collisions on the model/mesh - only on the bounding box for the entity.
signature
|
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
|
argument name
|
type
|
description
|
v1
|
vector
|
start position of raycast
|
v2
|
vector
|
end position of raycast
|
nomonsters
|
float
|
TRUE/FALSE should raycast ignore monsters?
|
forent
|
entity
|
this entity and its .owner will be ignored for collisions
|
traceline sets the following global variables:
name
|
description
|
trace_allsolid
|
'never used' - is it when the whole trace was in a wall?
|
trace_startsolid
|
'never used' - is it when the start of the trace is in a wall?
|
trace_fraction
|
how far along (what percent) the line was traversed before there was a collision
|
trace_endpos
|
either the end of the line or the location of the collision
|
trace_plane_normal
|
the surface normal of whatever was hit
|
trace_plane_dist
|
distance in game units from start to collision (or end)
|
trace_ent
|
If the trace collided with an entity's bounding box, then the entity, otherwise 'world'/0
|
trace_inopen
|
TRUE/FALSE did the trace go through open air?
|
trace_inwater
|
TRUE/FALSE did the trace go through open water/lava/slime?
|
See also:
https://quakewiki.org/wiki/traceline