Rare case of portal not getting crossed when it should be

Is there something that doesn't work right in the latest GZDoom? Post about it here.

Moderator: GZDoom Developers

Forum rules
Please construct and post a simple demo whenever possible for all bug reports. Please provide links to everything.

If you can include a wad demonstrating the problem, please do so. Bug reports that include fully-constructed demos have a much better chance of being investigated in a timely manner than those that don't.

Please make a new topic for every bug. Don't combine multiple bugs into a single topic. Thanks!
User avatar
Fishytza
Posts: 781
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference
Contact:

Rare case of portal not getting crossed when it should be

Post by Fishytza »

Tested with 4.7.0 and g4.8pre-51-gbb44f3dcd

Apologies if the title seems a bit vague. It's rare in the sense that this was hard to pin down but I have a reproducible sample.
So basically I have a custom moving actor that moves between mapspots.
breaking-portal-test.wad
Contains a MAP01 replacement and a ZSCRIPT file
(7.36 KiB) Downloaded 35 times
In this test map a you'll see a flying zombieman moving between three points.
Two points in the STARTAN2 room and a third one is in the red room which is actually though a line portal.
When the zombieman attempts to fly back into the STARTAN2 room, it will vanish at the point where it should cross the portal. A few seconds later it'll be back, coming through a wall.
What's happened is that the zombieman ended up behind the portal's "buffer zone" instead of actually transitioning through the portal.

It's just a simple two-way static portal set up. (You can walk back and forth no problem.)
I've no idea if it's something to do with level.Vec3Offset() or Vec3To() since that's the only thing special in its code.
Spoiler: ZScript code
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Rare case of portal not getting crossed when it should b

Post by Graf Zahl »

You have to use TryMove instead of SetOrigin. The latter does not move the actor, it merely repositions it and thus is not portal aware.
User avatar
Fishytza
Posts: 781
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference
Contact:

Re: Rare case of portal not getting crossed when it should b

Post by Fishytza »

That seems to have fixed it. Thank you very much.

Although I was under the impression that Vec3Offset (with the "absolute" parameter being false) was portal aware as well?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Rare case of portal not getting crossed when it should b

Post by Graf Zahl »

You got that precisely reversed: 'absolute = true' DISABLES all portal checks.
User avatar
Fishytza
Posts: 781
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference
Contact:

Re: Rare case of portal not getting crossed when it should b

Post by Fishytza »

I guess I should have worded that differently.

At any case, shouldn't Vec3Offset (absolute = false) have taken care of any portal checks for SetOrigin?
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Rare case of portal not getting crossed when it should b

Post by Graf Zahl »

Normally, yes. This function is used for all internal offset calculations.
Post Reply

Return to “Bugs [GZDoom]”