Page 1 of 1

Something wrong with aircraft + turrets

Posted: 11 Mar 2007, 21:56
by Zpock
I'm having a lot of trouble with a new unit not aiming straight, an aircraft with turrets. So I tried changin a land unit that works properly normally, into an aircraft in the FBI, it starts to aim wrong:

Image

I think there is something up with heading/pitch aircraft get. You see the red arrow is what its aiming like, while it should aim along the green vector. The entire BOS script is also included so you can see there is nothing wrong there.

Of course I still might be wrong since a lot of mods have air units with turrets that seem to work right. The thing is that the air units stay pretty still in those mods, and this units FBI was setup so it does loops etc. So I suspect it gets the trigonometry confused up somehow by flying like this. Note that it's not doing anything fancy at the moment in the picture but still gets it wrong. If heading/pitch isnt relative to aircraft orientation, it would be aiming wrong if upside down for example, so I could expect this. But it's almost upright.

Code: Select all

//Walkscript() 
//{
//	turn wheel1 to x-axis <20> speed <150>;
//	wait-for-turn wheel1 around x-axis;
//	turn wheel1 to x-axis <0> speed <150>;   
//} 

SmokeUnit(healthpercent, sleeptime, smoketype)
{
	while( get BUILD_PERCENT_LEFT )
	{
		sleep 400;
	}
	while( TRUE )
	{
		healthpercent = get HEALTH;
		if( healthpercent < 66 )
		{
			smoketype = 256 | 2;
			if( Rand( 1, 66 ) < healthpercent )
			{
				smoketype = 256 | 1;
			}
			emit-sfx smoketype from turret;
		}
		sleeptime = healthpercent * 50;
		if( sleeptime < 200 )
		{
			sleeptime = 200;
		}
		sleep sleeptime;
	}
}

Create()
{
	moving = FALSE;
//        start-script Walkscript();
        start-script SmokeUnit();
}

StartMoving()
{
	moving = TRUE;
}

StopMoving()
{
	moving = FALSE;
}

RestoreAfterDelay()
{
	sleep 3000;
	turn turret to y-axis <0.000000> speed <185.000000>;
        turn gun to x-axis <0.000000> speed <185.000000>;
}


AimWeapon1(heading, pitch)
{
	signal SIG_AIM;
	set-signal-mask SIG_AIM;
	turn turret to y-axis heading speed <185.000000>;
	turn gun to x-axis <0.000000> - pitch speed <185.000000>;
    	wait-for-turn turret around y-axis;
	wait-for-turn gun around x-axis;
	start-script RestoreAfterDelay();
	return (1);
}

QueryWeapon1(piecenum)
{
	piecenum = flare;
}

AimFromWeapon1(piecenum)
{
	piecenum = flare;
}

SweetSpot(piecenum)
{
	piecenum = hull;
}

Killed(severity, corpsetype)
{
	if( severity <= 25 )
	{
		corpsetype = 1;
		explode ground type BITMAPONLY | BITMAP1;
		explode hull type BITMAPONLY | BITMAP3;
		explode turret type BITMAPONLY | BITMAP5;
		return (0);
	}
	if( severity <= 50 )
	{
		corpsetype = 2;
		explode ground type FALL | BITMAP3;
		explode hull type BITMAPONLY | BITMAP3;
		explode turret type BITMAPONLY | BITMAP5;
		return (0);
	}
	if( severity <= 99 )
	{
		corpsetype = 3;
		explode ground type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
		explode hull type BITMAPONLY | BITMAP3;
		explode turret type BITMAPONLY | BITMAP5;
		return (0);
	}
	corpsetype = 3;
	explode ground type FALL | SMOKE | FIRE | EXPLODE_ON_HIT | BITMAP3;
	explode hull type BITMAPONLY | BITMAP3;
	explode turret type BITMAPONLY | BITMAP5;
}

Posted: 12 Mar 2007, 18:21
by LordMatt
Moved to mods.

Posted: 12 Mar 2007, 18:33
by j5mello
this happens to any aircraft using a Fighter or Bomber movement style with turrets. Happens in FF all the time and im pretty sure it happens in other mods as well.

Posted: 12 Mar 2007, 19:18
by Guessmyname
Works with air units with hoverattack=1; though

Posted: 13 Mar 2007, 04:52
by Fanger
yes non gunship aircraft with turrets do not update their target heading based properly.. Im not sure how this would be solved..

Posted: 13 Mar 2007, 14:22
by Pxtl
Fanger wrote:yes non gunship aircraft with turrets do not update their target heading based properly.. Im not sure how this would be solved..
Really, this is an engine bug and should be treated as such. Somebody make a patch.

Posted: 13 Mar 2007, 14:53
by Fanger
yeah, this is the least of our worries considering aircraft, as it does not affect their ability to function, but is instead simply cosmetic..

There are other far more serious issues that need to be looked at..