Page 1 of 1

Using CG_Trace

Posted: Sun Oct 30, 2005 6:57 am
by torhu

Code: Select all

void	CG_Trace( trace_t *result, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end,  int skipNumber, int mask ) {
I think I understand the rest, but what do the mins and maxs parameters do?

Posted: Sun Oct 30, 2005 12:33 pm
by corncobman
It specifies the width of the trace, rather than trace using a line, you can trace with a particular size, and if the sides hit whatever you are tracing for, it will stop.

Posted: Sun Oct 30, 2005 2:09 pm
by ^misantropia^
Think of it as doing a sweep with a bounding box.

Posted: Mon Oct 31, 2005 12:41 am
by torhu
I figured that mins and maxs would specify a box, but I'm not quite sure exactly how. Could someone draw me some ascii art to show?

Posted: Mon Oct 31, 2005 11:38 am
by ^misantropia^
Think of the player's bounding box, which is 32x32x64 or (-16, -16, -32)-(16, 16, 32). If you run in a straight line, you're bound to bump into something solid sooner or later. Now that's exactly what CG_Trace() does.

Posted: Tue Nov 01, 2005 2:46 am
by torhu
Thanks. Somehow it didn't occur to me that mins and maxs are actually vectors, not single values. Think I've got it now. :)