Using CG_Trace

Locked
torhu
Posts: 76
Joined: Thu Jun 16, 2005 7:57 pm

Using CG_Trace

Post 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?
[url=http://www.smokin-guns.org]Smokin' Guns[/url]
[url=https://sites.google.com/site/monsterbrowser//]Monster Browser[/url]
corncobman
Posts: 304
Joined: Fri Aug 08, 2003 7:00 am

Post 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.
-It is not the fall that kills you. It's the sudden stop at the end. (Douglas Adams)-

[url=http://www.violationentertainment.com/misc/ccm]-An eyeful a day is bloody fantastic!-[/url]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post by ^misantropia^ »

Think of it as doing a sweep with a bounding box.
torhu
Posts: 76
Joined: Thu Jun 16, 2005 7:57 pm

Post 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?
[url=http://www.smokin-guns.org]Smokin' Guns[/url]
[url=https://sites.google.com/site/monsterbrowser//]Monster Browser[/url]
^misantropia^
Posts: 4022
Joined: Sat Mar 12, 2005 6:24 pm

Post 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.
torhu
Posts: 76
Joined: Thu Jun 16, 2005 7:57 pm

Post 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. :)
[url=http://www.smokin-guns.org]Smokin' Guns[/url]
[url=https://sites.google.com/site/monsterbrowser//]Monster Browser[/url]
Locked