From Quake Wiki


void traceline(vector v1, vector v2, float collisionType, entity ignore)

This function traces a line between v1 and v2 and sets many global variables depending on the results of the trace.


v1 - The start point of the trace
v2 - The end point of the trace
collisionType - How the trace interacts with other entities. 0 makes it collide with both the world and solid entities' bounding box. 1 makes it not collide with monsters (solid entities with the FL_MONSTER flag set on .flags). 2 makes the trace extra wide against monsters.



Global variables affected:[edit]

float trace_allsolid - (?)
float trace_startsolid - (?)
float trace_fraction - The fraction of the total length of the vector v2 - v1 that was traced before the trace hit an obstacle.
vector trace_endpos - The coordinates of the end point of the trace. If the trace did not hit anything, than trace_endpos = v2, otherwise it will report the position where the trace hit an obstacle.
vector trace_plane_normal - The normal of the plane that was hit by the trace.
float trace_plane_dist - The distance of the plane to the world origin (?)
entity trace_ent - The entity that was hit by the trace (if nothing was hit, returns world).
float trace_inopen - If the trace is in open air (?)
float trace_inwater; - If the trace is in water (?)