Vel3DFromAngle has a chance to not affect vertical velocity

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
Kzer-Za
Posts: 521
Joined: Sat Aug 19, 2017 11:52 pm
Graphics Processor: nVidia (Modern GZDoom)

Vel3DFromAngle has a chance to not affect vertical velocity

Post by Kzer-Za »

Create a mod with this zscript:

Code: Select all

version "3.3"

class TestBall : DoomImpBall replaces DoomImpBall
{
	int SpawnTime;
	bool Spawned;
	
	override void PostBeginPlay()
	{
		super.PostBeginPlay();
		
		if (!Spawned)
		{
			let misl = TestBall(Spawn("TestBall",pos));
			if (misl)
			{
				misl.target = target;
				misl.angle = angle;
				misl.pitch = pitch;
				misl.Vel3DFromAngle(speed, misl.angle, target.BulletSlope());
				misl.SpawnTime = level.time;
				SpawnTime = level.time;
				misl.Spawned = true;
			}
		}
	}
	
	override void Tick()
	{
		Super.Tick();
		
		if (!Spawned && (level.time - SpawnTime > 0))
		{
			SetStateLabel("null");
		}
	}
}
Start a game with this mod and summon DoomImp. Use the code "noclip2" and fly above the Imp's level. As he throws his balls at you, you will notice that some of them are not aimed at you vertically, but go below you, with strictly horizontal velocity. It is statistical, so sometimes you have to wait a lot of time before even one such miscalculated ball appears, but sometimes almost all of them go horizontally. So I advise also creating a MAPINFO with "Aggressiveness = 1.0" skill definition, so that the Imp throws the balls more often.

I'm gonna also upload a zip with both zscript and mapinfo, ready for testing.

Before you say that this mod this meaningless: I know that, this mod is this simple only for testing purposes. I found this issue with Vel3DFromAngle while doing something else. It really does have a chance to not affect the actor's vertical velocity, so other mods may be affected.
Attachments
Test.zip
(669 Bytes) Downloaded 37 times
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49234
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Vel3DFromAngle has a chance to not affect vertical veloc

Post by Graf Zahl »

Vel3DFromAngle is not at fault here - this happens if BulletSlope does not return a valid aiming pitch. You have to check the returned target as well and not blindly pass on just the pitch, because you need to consider the failure case
Post Reply

Return to “Closed Bugs [GZDoom]”