Check if Flying
Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. This forum is archived - please use this set of forums to ask new questions.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Check if Flying
This one's been a back-burner question for me for a very long time now. I have some player characters that I want to have a separate animation state while flying, so that they're visibly flapping their wings (or whatever the appropriate analogue may be). Is there any method I can use to perform a state jump if they're flying? So far I haven't come across a way to check an actor for the status of 'flying'. Suggestions?
Re: Check if Flying
That depends on how you have the flight implemented. If it is a powerup, you can check for the powerup using A_JumpIfInventory. If it uses the gravity property, it is a little more complicated. Using a combination of A_JumpIf with CallACS to call a script that has CheckActorProperty/GetActorProperty (APROP_Gravity) and SetResultValue should work. You may need to tweak it a bit to not show the flying animation all the time, especially if you are running on the ground with flight still active.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Check if Flying
I wouldn't be too crushed about having the flying animation play when touching the ground, so long as flight was still engaged. My biggest concern is that if I were simply using a check for the powerup with A_JumpIfInventory, and the player hit the 'stop flying' button, the flying animation would still be playing, even while the player may be walking, jumping around... all because the power is still in their inventory, but is simply not active. As for the gravity factor... it sounds like the right direction, but I'm worried about other scenarios that can negate gravity (such as wandering into a no-gravity sector or something) that would force the animation. Perhaps I could do both, and have a two-step authentication so that the jump to the proper animation would only happen if both the powerup was in the inventory AND the gravity was at 0?
I'll look into this and report back on how successful I am. Thanks for the tips!
I'll look into this and report back on how successful I am. Thanks for the tips!
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Check if Flying
Well, it seemed like a solid plan, but either I've done something wrong (highly possible) or it doesn't work quite how I would need it to... It appears that a player's gravity property (APROP_Gravity) is constantly 65536, whether in flight or not. So it looks like I'm going to need a different way to run the check.
- NeuralStunner
-

- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: No Preference
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
- Contact:
Re: Check if Flying
65536 is 1.0 in ACS fixed-point.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Check if Flying
Yes, I believe it's also that in DeHackEd. Point is, it's the same value on a player character no matter whether he's in flight or not. And if it's not changing, it's not going to be useful as a check for what I'm trying to achieve.NeuralStunner wrote:65536 is 1.0 in ACS fixed-point.
- Ed the Bat
- Posts: 3060
- Joined: Thu May 03, 2012 1:18 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Maryland, US
- Contact:
Re: Check if Flying
I'm actually using that as my current solution; the flight power is removed upon hitting the floor, which means most (though not all) situations where someone hits 'stop flying' will end the flight animation reliably, though the downside is that touching down will end flight, like it or not. And as I said, it's not perfect, because floors are not the only thing players can walk/jump on.MG_Man wrote:A_CheckFloor?
