Not Detecting CONTENT_SOLID With Pointcontents
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
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!
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!
-

Junrall - Posts: 191
- Joined: Mon Sep 21, 2009 12:27 am
- Location: North West Oregon, USA
.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) ...
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
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
so yeah, what sajt said
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
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.
Thanks for the tip... and hope that I can return the favor sometime in the future.
Good God! You shot my leg off!
-

Junrall - Posts: 191
- Joined: Mon Sep 21, 2009 12:27 am
- Location: North West Oregon, USA
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest