View previous topic :: View next topic |
Author |
Message |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Fri Feb 05, 2010 4:47 am Post subject: Not Detecting CONTENT_SOLID With Pointcontents |
|
|
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! |
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Fri Feb 05, 2010 7:26 pm Post subject: |
|
|
.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. |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Fri Feb 05, 2010 9:26 pm Post subject: |
|
|
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 _________________ What's a signature? |
|
Back to top |
|
 |
Junrall

Joined: 21 Sep 2009 Posts: 136 Location: North West Oregon, USA
|
Posted: Sat Feb 06, 2010 2:34 am Post subject: |
|
|
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.
Thanks for the tip... and hope that I can return the favor sometime in the future. _________________ Good God! You shot my leg off! |
|
Back to top |
|
 |
|