Something wrong with aircraft + turrets

Something wrong with aircraft + turrets

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
Zpock
Posts: 1218
Joined: 16 Sep 2004, 23:20

Something wrong with aircraft + turrets

Post 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;
}
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Moved to mods.
j5mello
Posts: 1189
Joined: 26 Aug 2005, 05:40

Post 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.
User avatar
Guessmyname
Posts: 3301
Joined: 28 Apr 2005, 21:07

Post by Guessmyname »

Works with air units with hoverattack=1; though
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post by Fanger »

yes non gunship aircraft with turrets do not update their target heading based properly.. Im not sure how this would be solved..
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post 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.
User avatar
Fanger
Expand & Exterminate Developer
Posts: 1509
Joined: 22 Nov 2005, 22:58

Post 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..
Post Reply

Return to “Game Development”