In the current implementation of actors that use the flag "UseSpecial" it does not (Or cannot) check the player's height in relation to the object. As such, you can be directly above the actor, even with a 3-d floor separating you, but still be able to activate it.
An additional flag, or altered, flag, such as "+UseSpecialCheckRange" or "+CheckRange", that does check the height distance (Much like "CheckSwitchRange") would be greatly appreciated and useful should anyone be creating a multi-floored building that utilizes "UseSpecial" actors.
I assumed that the lack of height checking was an intentional thing (Much like how Doom is that way by default), so that's why this idea is in the Feature Suggestions, not listed as a Bug.
An Extra +UseSpecial Flag to Check Height
Moderator: GZDoom Developers
-
- Posts: 531
- Joined: Sun Sep 05, 2010 12:09 pm
- Preferred Pronouns: He/Him
- Location: The Fortress of Dr. Radiaki
-
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
Re: An Extra +UseSpecial Flag to Check Height
I've thought of this before. I looked into adding it myself, but I never actually figured out where the activations are done.
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: An Extra +UseSpecial Flag to Check Height
Another useful check would be checking if the player's pitch is within the range of the actor also (so it shouldn't be possible to talk to someone in front of you when you are looking 90 degrees up :P)
-
-
- Posts: 12328
- Joined: Tue Jul 21, 2009 12:04 pm
- Preferred Pronouns: He/Him
- Operating System Version (Optional): Windows 11
- Graphics Processor: nVidia with Vulkan support
- Location: capital N, capital S, no space
Re: An Extra +UseSpecial Flag to Check Height
It would be nicest if it "simply" respected CheckSwitchRange, without need for another addition. But that would be harmful to backward compatibility, wouldn't it?
-
- Posts: 386
- Joined: Thu Jun 11, 2015 8:38 am
Re: An Extra +UseSpecial Flag to Check Height
was this ever "solved"? I need to be able to make checkrange on actors that has +UseSpecial
-
- Posts: 537
- Joined: Wed Dec 22, 2021 7:02 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: Medellin, Colombia
Re: An Extra +UseSpecial Flag to Check Height
It would be nice to have an engine feature, but it's possible to code this yourself.
I have an object that can only be used from the front side, so I had to write code to check the user against the object before doing the use function.
Here's my thread. It's not exactly waht you're looking for because I don't consider pitch/z in my object because it's not important to me in the way I have my level layed out, but you get the idea of how you can do that yourself. Mine is projecting a plane out from the center of the object and checking for collisions with that. I do it that way because I wanted 360 degree accuracy. If you're only needing axis-aligned hitbox accuracy, the math is way simpler.
Something like this:
I have an object that can only be used from the front side, so I had to write code to check the user against the object before doing the use function.
Here's my thread. It's not exactly waht you're looking for because I don't consider pitch/z in my object because it's not important to me in the way I have my level layed out, but you get the idea of how you can do that yourself. Mine is projecting a plane out from the center of the object and checking for collisions with that. I do it that way because I wanted 360 degree accuracy. If you're only needing axis-aligned hitbox accuracy, the math is way simpler.
Something like this:
Code: Select all
class zUsable : actor
{
default {+special}
override bool used(actor user)
{
if (!isAimingAtMe(user)) return false;
//do your used action here
return true;
}
bool isAimingAtMe(actor other)
{
//calculate a ray from other's pos, angle, and pitch
//check if that ray intersect's the caller's hitbox
//return the result
}
}
-
- Posts: 537
- Joined: Wed Dec 22, 2021 7:02 pm
- Graphics Processor: Intel (Modern GZDoom)
- Location: Medellin, Colombia
Re: An Extra +UseSpecial Flag to Check Height
You know what? I'm over compilcating it. Here's a used function with a simple z check:
Code: Select all
class UsableWithZCheck : actor //actor is usable with a z check
{
override bool used(actor user)
{
if (!user) return false;
if (user.pos.z > pos.z+height) return false;
if (user.pos.z+user.height < pos.z) return false;
return usedz(user);
}
virtual bool usedz(actor user)
{
console.printf(level.time..": "..GetCharacterName()..": usedz by "..(user?user.GetCharacterName():"something"));//DEBUG
return false;
}
}