A Turret on a turret

A Turret on a turret

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
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

A Turret on a turret

Post by Erik »

So i got the big tank with an small machingun turret ontop of the main turret. How can i make it target and turn indivdually? I tried several things but the (visual) aim angle is always off by the degree of the main turret, while the shots go in the right direction.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: A Turret on a turret

Post by Master-Athmos »

Don't make the MG a child object of the turret because if you do so the MG always will be connected to the turret's movement...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: A Turret on a turret

Post by rattle »

It's possible to reaim the top turret visually even when it is a child, however to make it easy put the top turret in the center of the bottom one so you don't have to worry about that
yo dawg i herd you like turrets, so i put a turret on yo turret so you can reaim while you aim
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: A Turret on a turret

Post by Evil4Zerggin »

What you need to do is put an empty piece between the main turret and the pintle. When aiming the main turret, turn the empty piece in the opposite direction. That way the base of the pintle will always point the same as the unit, not the main turret.

s44 has the same problem, just nobody's gotten around to fixing it.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: A Turret on a turret

Post by FLOZi »

Evil4Zerggin wrote:What you need to do is put an empty piece between the main turret and the pintle. When aiming the main turret, turn the empty piece in the opposite direction. That way the base of the pintle will always point the same as the unit, not the main turret.

s44 has the same problem, just nobody's gotten around to fixing it.
They did have working ones at some point with some fancy zwzsg code... dunno when it all got broken.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: A Turret on a turret

Post by Forboding Angel »

Guys it's easy
Just don't attach the turret on the top the the biece below it, attach it to the chassis.

Visually it will still look exactly the same and not need any crazy hacky code in cob.

Hierarchy:
Chassis
|-turretmain
|-turrettop
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: A Turret on a turret

Post by Evil4Zerggin »

Yeah, that's a simpler way to do it, provided the sub-turret is centered on the main turret.
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: A Turret on a turret

Post by Forboding Angel »

No, the top turret isn't connected to the main turret, so then all you ahve to do is set the object origin centered on the top turret.

This really isn't difficult.
Master-Athmos
Posts: 916
Joined: 27 Jun 2009, 01:32

Re: A Turret on a turret

Post by Master-Athmos »

Actually Evil4Zerggin has a point here - if your MG isn't centered above the main turret you need to have it attached as a child (like for THIS TANK)...

When the main turret turns the MG cannot stay in place but has to move with it as it simply is attached to the turret. You could solve this point by still having the MG as an independent child and setting its center to the identical place of the main turret and just do another turn call in the aiming script. This would totally break the MG's ability to aim though (as it'd just rotate around the main turret center and not around itself...
User avatar
rattle
Damned Developer
Posts: 8278
Joined: 01 Jun 2006, 13:15

Re: A Turret on a turret

Post by rattle »

Forboding Angel wrote:No, the top turret isn't connected to the main turret, so then all you ahve to do is set the object origin centered on the top turret.

This really isn't difficult.
...unless you don't want it centered which is likely for a machine gun on top of a tank's turret
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: A Turret on a turret

Post by Forboding Angel »

hmm

YOu could jsut give the top turret a much faster turn speed than the main turret. Use different signals, and you should get the desired effect. Or even easier, use the same signal for both (so they'll both aim at the same target religiously.
User avatar
Erik
Posts: 283
Joined: 20 Aug 2009, 20:49

Re: A Turret on a turret

Post by Erik »

Well then i could just make the MG coaxial and unable to turn at all hm?
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: A Turret on a turret

Post by KDR_11k »

Seriously, why talk about workarounds when it has already been answered:
Evil4Zerggin wrote:What you need to do is put an empty piece between the main turret and the pintle. When aiming the main turret, turn the empty piece in the opposite direction. That way the base of the pintle will always point the same as the unit, not the main turret.
Post Reply

Return to “Game Development”