An Extra +UseSpecial Flag to Check Height

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

Moderator: GZDoom Developers

User avatar
Ral22
Posts: 531
Joined: Sun Sep 05, 2010 12:09 pm
Preferred Pronouns: He/Him
Location: The Fortress of Dr. Radiaki
Contact:

An Extra +UseSpecial Flag to Check Height

Post by Ral22 »

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.
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: An Extra +UseSpecial Flag to Check Height

Post by NeuralStunner »

I've thought of this before. I looked into adding it myself, but I never actually figured out where the activations are done.
User avatar
Nash
 
 
Posts: 17439
Joined: Mon Oct 27, 2003 12:07 am
Location: Kuala Lumpur, Malaysia
Contact:

Re: An Extra +UseSpecial Flag to Check Height

Post by Nash »

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)
User avatar
NeuralStunner
 
 
Posts: 12326
Joined: Tue Jul 21, 2009 12:04 pm
Preferred Pronouns: He/Him
Graphics Processor: nVidia with Vulkan support
Location: capital N, capital S, no space
Contact:

Re: An Extra +UseSpecial Flag to Check Height

Post by NeuralStunner »

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? :?
User avatar
camaxide
Posts: 382
Joined: Thu Jun 11, 2015 8:38 am

Re: An Extra +UseSpecial Flag to Check Height

Post by camaxide »

was this ever "solved"? I need to be able to make checkrange on actors that has +UseSpecial :)
User avatar
Sir Robin
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

Post by Sir Robin »

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:

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
	}
}
User avatar
Sir Robin
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

Post by Sir Robin »

camaxide wrote: Sat Oct 07, 2023 5:28 am was this ever "solved"? I need to be able to make checkrange on actors that has +UseSpecial :)
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;
	}
}
Post Reply

Return to “Feature Suggestions [GZDoom]”