Vel3DFromAngle has a chance to not affect vertical velocity

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 a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Vel3DFromAngle has a chance to not affect vertical velocity

Re: Vel3DFromAngle has a chance to not affect vertical veloc

by Graf Zahl » Tue Apr 12, 2022 6:26 am

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

Vel3DFromAngle has a chance to not affect vertical velocity

by Kzer-Za » Sun Dec 05, 2021 1:02 am

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

Top