Forum

Not Detecting CONTENT_SOLID With Pointcontents

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Not Detecting CONTENT_SOLID With Pointcontents

Postby Junrall » Fri Feb 05, 2010 4:47 am

Hello fellow QC'ers,

I'm starting a traceline at waist height and ending at 5 units below self.mins_z and using pointcontents(trace_endpos) to detect contents.
I'm able to get pointcontents to return the values for CONTENT_WATER, CONTENT_SLIME, and CONTENT_LAVA... however, when ever it touches the floor it returns CONTENT_EMPTY instead of CONTENT_SOLID.
Am I using pointcontents improperly? Or should I just use trace_fraction != 1.0?

Thank you in advance!
Good God! You shot my leg off!
User avatar
Junrall
 
Posts: 191
Joined: Mon Sep 21, 2009 12:27 am
Location: North West Oregon, USA

Postby Sajt » Fri Feb 05, 2010 7:26 pm

.mins and .maxs are relative to the entity's origin. You should add it with the origin, or just use absmin/absmax instead. Although based on your results with water already, I guess you already took care of that.

You're checking pointcontents at the impact position, which in the case of impact is just "on" the surface, which could go either way based on floating-point error and how the engine works. You should push the pointcontents position a little into the surface.

traceline(self.origin, self.absmin - '0 0 5', FALSE, self);
if (trace_fraction < 1)
trace_end_pos = trace_end_pos - '0 0 1';

pointcontents(trace_end_pos) ...
F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe.
Sajt
 
Posts: 1215
Joined: Sat Oct 16, 2004 3:39 am

Postby Spike » Fri Feb 05, 2010 9:26 pm

traces end 1/32th of a quake unit away from where they hit, so testing such a point will nearly always be empty. There's a veeery slight chance that you can get solid, but it ain't gonna happen until someone else reports it as a bug :P
so yeah, what sajt said
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Junrall » Sat Feb 06, 2010 2:34 am

Right on! That was the problem... there are so many little things like this that aren't documented anywhere... well, this one is now documented here on the forums.:wink:

Thanks for the tip... and hope that I can return the favor sometime in the future.
Good God! You shot my leg off!
User avatar
Junrall
 
Posts: 191
Joined: Mon Sep 21, 2009 12:27 am
Location: North West Oregon, USA


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest