HitPlane/Wall

Remember, just because you request it, that doesn't mean you'll get it.

Moderator: GZDoom Developers

User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

HitPlane/Wall

Post by Major Cooke »

I'm working on creating these virtuals for projectiles after talking about them with Marisa Kirisame. The idea behind these is like SpecialMissileHit but for map geometry.

Code: Select all

virtual int HitWall( Line hitline, int hitside, int hitpart, F3DFloor ffloor );
virtual int HitPlane( Sector hitsector, int hitpart, F3DFloor ffloor );
  • hitside - Indicates if the front, dead center or back of the wall was hit.
  • hitpart - For walls, it's Side's ETexpart's top (0), mid (1) or bottom (2) constants. For planes, it's Sector's EPlane's floor (0) or ceiling (1) constants (although I don't know why they're reversed like that...)
  • ffloor - Simply not null if it's actually a 3D floor that it hits.
The returns are just like SpecialMissileHit: -1 to let the engine handle it, 0 to blow up the missile, 1 to allow passing through terrain like it's not there. Want a projectile to pass through all 3D floors? Return 1 if ffloor isn't null!

If this works out well enough I may just invest time into getting these working properly with solids. But this could still be tricky.

The reason I'm working on this is because BlockingLine/Floor/Ceiling can sometimes return false positives and are very unreliable at times. I've seen BlockingLine being non-null when going over a line that's not actually supposed to be blocking.
User avatar
Apeirogon
Posts: 1606
Joined: Mon Jun 12, 2017 12:57 am

Re: HitPlane/Wall

Post by Apeirogon »

Major Cooke wrote:BlockingLine/Floor/Ceiling can sometimes return false positives
Maybe its better to fix those cases when it bugs, rather than create workaround around bug?
Major Cooke wrote:I've seen BlockingLine being non-null when going over a line that's not actually supposed to be blocking.
IIRC gzdom internally set any line actor touch as blocking line, regardless of its type (one sided two sided) and flags on it.
User avatar
phantombeta
Posts: 2169
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: HitPlane/Wall

Post by phantombeta »

Apeirogon wrote:
Major Cooke wrote:BlockingLine/Floor/Ceiling can sometimes return false positives
Maybe its better to fix those cases when it bugs, rather than create workaround around bug?
Returning false positives does not mean there are bugs. They're working correctly for what the C++ source code uses them for.
User avatar
Marisa the Magician
Banned User
Posts: 3886
Joined: Fri Feb 08, 2008 9:15 am
Preferred Pronouns: She/Her
Operating System Version (Optional): (btw I use) Arch
Graphics Processor: nVidia with Vulkan support
Location: Vigo, Galicia
Contact:

Re: HitPlane/Wall

Post by Marisa the Magician »

Honestly the main point of these have very little to do with "bugs" or whatever, but it's more about being able to precisely know when something collides with world geometry, without having to, say, do some complicated Tick override that checks the before/after of every move they perform (and even then it's still very hard to check exactly what they bumped into). Also they would allow for having finer control on bouncing behaviour (e.g.: making missiles have different bouncing angles, only bouncing on specific textures, etc.)
User avatar
Major Cooke
Posts: 8209
Joined: Sun Jan 28, 2007 3:55 pm
Preferred Pronouns: He/Him
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: GZBoomer Town
Contact:

Re: HitPlane/Wall

Post by Major Cooke »

Agreed. Right now the only troubling thing I have to put up with is figuring out where and when to have the function calls.
Apeirogon wrote:IIRC gzdom internally set any line actor touch as blocking line, regardless of its type (one sided two sided) and flags on it.
Which is exactly what this is for, to go through and iterate against all lines that may turn out as potential blocking.
Post Reply

Return to “Feature Suggestions [GZDoom]”