Hard Light Productions Forums

Modding, Mission Design, and Coding => The Modding Workshop => Topic started by: MetalDestroyer on December 22, 2005, 06:20:20 pm

Title: How to create rotative turrets with multipart firing part
Post by: MetalDestroyer on December 22, 2005, 06:20:20 pm
I maked some hours ago, a turbolaser turret for my Victory I. But, When I finish to place all the turret into the Destroyer, turrets don't move correctly for some, and if they move, they can't shoot me until I'm 45° higher.

I want a turret behavior like the one from Freespace 2 ships (Aeolus, Deimos, Triton, Orion). How to do that ? Should I use Modelviewer for this or PCS 1.3 ?
Title: Re: How to create rotative turrets with multipart firing part
Post by: Trivial Psychic on December 22, 2005, 11:56:27 pm
What kind of fof did you give the submodel in the pof data?
Title: Re: How to create rotative turrets with multipart firing part
Post by: MetalDestroyer on December 23, 2005, 04:16:04 am
I give them a FOV of 90. Per default, ModelView give them a value of 180. What do exactly the FOV in the turret behavior ? It's the way they can turn with their base ? or the way the barrel can move verticaly ?
Title: Re: How to create rotative turrets with multipart
Post by: Wanderer on December 23, 2005, 04:30:52 am
FOV defines the barrels rotation limits as a maximum deviation form the straight up position (elevation of 90 degrees).


A firing cone that is centered around turrets normal (single parts) or around xy-plane (multi parts). FOV=90 gives a turret a firing cone of 90 degrees so the barrels can not reach lower elevations than 45 degrees (90 / 2 = 45). By assigning FOV= 180 turrets will fire even with zero elevation
Title: Re: How to create rotative turrets with multipart firing part
Post by: MetalDestroyer on December 23, 2005, 05:02:55 am
So, if i put the barrel at 45 degrees, and I give them a FOV of 90,  the turret can shoot lower than 45° ? (so the turret can fire from O° up to 90° )
Because, all the Fs2 capital ships have turret pointed to 90 degrees and so I don't really understand the reason.

Title: Re: How to create rotative turrets with multipart
Post by: StratComm on December 23, 2005, 10:40:31 am
No, no, no.  The barrel must ALWAYS point straight up.  Otherwise you get exactly the behavior that was described.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Trivial Psychic on December 23, 2005, 12:20:34 pm
Because, all the Fs2 capital ships have turret pointed to 90 degrees and so I don't really understand the reason.

That's currently a limitation of the Freespace Engine.  All multi-part turret barrels (arms)  MUST point directly up or directly down.  Its one of the most annyong limitations that MODers have to work within.  Basically, if you want your multi-part turret to be able to fire at 90 degrees offset from the barrels in one direction, it MUST be able to do the same in any direction.  Basically, set the fof to 180, and you'll have to live with any firing through the hull that occurs.

Now, some time ago, Bobbeau added some code to prevent weapons firing through any model or submodel that they're attatched to, but it had to be removed, as it broke some missions.  In FS2 "Feint, Parry, Reposite", the one when the Collossus takes out the Repulse, the Collossus is scripted to fire its main beams on the Repulse, but it ends up firing through its own hull partially, so the mission wasn't working properly, and the code was removed.  Its been suggested from time to time, that this code might be reintroduced, but by flag only, in the ships table.  That way, it would only be activated on models that experience weapons firing though the hull often, for mods.

Also, WMC recently posted some WIP code for viewing, in the SCP forum, about how to possibly get non-vertical multi-part turrets enabled, but there's no guarentee that it would work.  He just posted it up incase anyone had any ideas to overcome some problems he was encountering (IIRC).
Title: Re: How to create rotative turrets with multipart firing part
Post by: MetalDestroyer on December 23, 2005, 01:03:48 pm
So, as I understand, if the arm aim at 90 degrees and FOV = 90, the barrels can't shoot lower than 45 degrees in both side, right ?
My turret structure have a physical limitation, the barrel mustn't aim to the other side. It's for Imperial Destroyer class.


(http://img398.imageshack.us/img398/489/tourelleb4kf.jpg)
Title: Re: How to create rotative turrets with multipart firing part
Post by: Trivial Psychic on December 23, 2005, 01:49:08 pm
Don't worry.  As long as the base submodel is rotational, you'll never have to worry about the barrel moving outside the grove you've made.  If it has to target any ship thats further back than straight up, the turret base will rotate around to target.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Omniscaper on December 23, 2005, 02:01:00 pm
Is it possible for a turret to have an additional submodel, that would follow the barrel's rotational position, but have its own pivot point?

Example, the BSG has Flak turrets that have a gunner window compartment that matches the barrel's rotation. The problem is, in this instance, the gunner window's location is not the same as the barrrel's. So linking the gunner compartment with the barrel will only move the compartment out of its proper position.

I think this would be a cool feature that would allow for multiple barrels that can rotate independently.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Nuke on January 01, 2006, 12:32:21 am
yea that would be cool omni, but i think thats a limitation with the turret chunk, you can only specify one barrel subobject per turret. however im trying to get them to implement certain animation triggers that would allow for gatling turrets. i figure they could implement animation functions that would allow for the effect youre after while there at it.
Title: Re: How to create rotative turrets with multipart firing part
Post by: WMCoolmon on January 02, 2006, 01:50:35 pm
I don't know if POF files even support that. You'd have to make some semi-fundamental data structure changes for subobjects in the code too.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Nuke on January 03, 2006, 06:11:07 am
i was told at some point by a coder that gatling turrets may be viable through the animation code. so long as you can make an object inherit a turret object's rotation you could implement a linked animation in which the turret returns its elevation and rotation. if that information can be linked to an object rotation and objects can inherit their parent's rotation even if its perrent is part of a turret, then it can be done. gatling turrets only require the latter, a turret fire trigger event, and incremintal rotation. i actually have put a subsystem on a turret that is a cild of the barel subobject (yes its a gatling gun) and it inherits the barrels movements, but i havent tried animating it yet.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Le Jedi Fou on January 03, 2006, 09:32:02 am
Ok here's another answer : how do I create a rotative single-part turret? I've created the multi-part one correctly (with normal poiting straight up or straight down). Now I'm trying to make a turret rotate on the side of the ship.
Here's the ship and the turret in ModelView32 (clicky)
(http://perso.wanadoo.fr/massacre/fs2/turret1s.jpg) (http://perso.wanadoo.fr/massacre/fs2/turret1.jpg)

Because the turret is on the side of the ship, I've created a singlepart turret. The cannons are placed at 45°, so it should look better. But the normals point to the side of the ship, with a 170° FOV. I've checked the Rotate around X-axis, and when I click on the Rotate Parts button, it animates well.

However ingame the turret doesn't rotate. It fires correctly on every side (left, right, up, down), but the turret just doesn't rotate.

Any idea? Can I make a single-part turret rotate ? How ? Is it limited to multi-parts turrets or to top/bottom turrets (or both) and not side turrets ? What am I doing wrong ?

Thanks
Title: Re: How to create rotative turrets with multipart
Post by: StratComm on January 03, 2006, 10:42:27 pm
Freespace doesn't support any form of rotational turrets other than the multipart variety as far as I know.  If they do, then I've never seen a working example of them, but I seriously doubt that sort of support exists.  It may eventually be possible to use side multipart turrets as well as top and bottom ones though, so stay on the lookout for that.
Title: Re: How to create rotative turrets with multipart firing part
Post by: Trivial Psychic on January 03, 2006, 11:07:11 pm
I have seen rotating single-part turrets, but like the multi-part variety, these were either dorsal or ventral types.  They were on the GTC Ticonderoga by Hamano.  I think that the reason that side-mounted single-part rotational turrets don't work properly, is because regardless of how you set it in the pof data, the code will force the base submodel (or the whole thing in cases of single-part) to rotate around the vertical axis.  You may rather have it rotate around a lateral axis, but the code will override what you set.