Author Topic: Rotating Primary Weapons  (Read 3370 times)

0 Members and 1 Guest are viewing this topic.

Offline Mahak

  • 25
Rotating Primary Weapons
Hi all,

I'm trying to get the visible external primary weapons code to work, specifically the rotation...

Does anyone know if this feature is fully functional yet?  I notice on the table file help (weapons.tbl) it simply states that the rotation speed and acceleration is defined by a float, with nothing to determine axis or anything...  When I implement it, the TIMING of the rotation seems to work (i.e. depending on the values I use, I need to hold the trigger down before the weapon starts firing, like a 'wind-up effect) but the actual weapon model does not rotate itself.

Does it maybe need some animation frames or something?  Has anyone successfully got this to work yet?

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Rotating Primary Weapons
Check out Steve-O's weapon models from the Federal Fighters Pack. Several of them have rotating external weapons (I believe).

If none of them do, we can dig some tables up for you from Blue Planet.

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Yep, that I know - I have entered those options in on the table file, but they do nothing to the physical model, as I mentioned, although it does seem to alter the weapon firing, as I mentioned.

I checked out Steve-o's stuff, looks like the animations are done via a .tbm, and triggered via scripting, which would make the weapons.tbl entries null and void...  Hmmm...

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Rotating Primary Weapons
Basically, you need to edit your weapon model a bit. Select the subobject you want to have rotating, define the rotation axis, and give it the "$gun_rotation" property.
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline Getter Robo G

  • 211
  • Elite Super Robot Pilot
Re: Rotating Primary Weapons
Nuke mod also has them spin up. And ani in the tbm entries.

His primaries are separate models and are mounted on the ship via the firing point.

Which can get really odd if you misplace the point on the ship.

Floating, rotating machine guns!  :D


"Don't think of it as being out-numbered, think of it as having a WIDE target selection!"

"I am the one and ONLY Star Dragon..."
Proof for the noobs:  Member Search

[I'm Just an idea guy, NOT: a modeler, texturer, or coder... Word of advice, "Watch out for the ducks!"]

Robotech II - Continuing...
FS2 Trek - Snails move faster than me...
Star Blazers: Journey to Iscandar...
FS GUNDAM - The Myth lives on... :)

 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Right, so I kind of get what I NEED to do, but HOW to do it is confusing me...  I understand there are several options...

What I have tried:
Set up a submodel of the main model as 'gun', and set its rotation type (to 'rotate'... duh) and axis in PCS2, also adding '$gun_rotation' as a subobject property.  I assume that setting this property allows the code to use the values $submodel_rotation_speed and $submodel_rotation_acceleration in weapons.tbl to define speed and acceleration... or not?

It doesn't work.

Also tried adding this to my ship entry in ships.tbl:
   $default PBanks:   ( "Gun" )
   $animation:      triggered
   $type:         primary_bank
   +sub_type:      0
   +delay:         0
   +absolute_angle:   180,0,0
   +velocity:         200,0,0
   +acceleration:      120,0,0
   +time:         2000

This doesn't work either.

I also tried the option of doing a separate export for the weapon, and mounting it separately (as described by Getter Robo G).  Didn't work.  Also tried defining rotation type and axis using PCS2 on this separately exported weapon model.  Also didn't work.

I will be clear - the weapon fires, the submodel just doesn't rotate.

What am I doing wrong?  The animation code stuff is cut and paste from what I could see in Steve-o's mod, just not in a .tbm.  Does it NEED to be in a .tbm?  My understanding is that it would work fine just being added to the ship entry in ships.tbl...

Sigh.  Bet it's some really easy step I'm missing...


 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Also, it should go without saying that I've tried variations of the values in all the table entries, from 0.01 up to 1000... no dice.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rotating Primary Weapons
also why are you using the animation code. first of all it sucks for this kinda thing, second its probably gonna get pulled from the code base if someone (bobboau) doesn't work on it.
you need 3 things:

a weapon table entry with something like this in it

Code: [Select]
$Model File: projectile.pof
$External Model File: spinnyweaponmodel.pof
$Submodel Rotation Speed: 60
$Submodel Rotation Acceleration: 40
$Mass: -25

then you need a model, it should have a hull model with a subobject that will spin (i usually just use an invisible base hull), the subobject that will spin needs to have a special subobject property.
Basically, you need to edit your weapon model a bit. Select the subobject you want to have rotating, define the rotation axis, and give it the "$gun_rotation" property.

and for the third thing, i cant remember. it could be there was no 3rd thing at all and im just loosing my mind. or its something simple like a ship which can mount the gun.
« Last Edit: May 21, 2010, 01:55:07 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Weird, cos thats pretty much what I've got, and it still doesn't work...  When you say a subobject that spins, you mean a subobject that WILL spin, yes?  Not a subobject that you have animated in your 3d program of choice and exported as a .ani or anything weird, right?  To me it really does look like it should be simple; define the weapon.pof and set it's values in weapons.tbl, set the property in the pof and bob SHOULD be my uncle...  Grrr.

I'm going to go back, start from scratch with a new set of test models and test weapon entry in the table, download a new set of .exe's (btw I'm running 3.6.10 - I also tried the inferno builds) and see what happens.

Once again, I have to rave about how supportive this whole community is - nowhere else on the internets do I get such quick and helpful replies to questions like this...  Woot y'all.

M.

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Rotating Primary Weapons
Quote
second its probably gonna get pulled from the code base if someone (bobboau) doesn't work on it.
BS.
Too many things use the current animation code already. Unless someone makes a proper replacement for it, that stuff stays.

Quote
What I have tried:
Set up a submodel of the main model as 'gun', and set its rotation type (to 'rotate'... duh) and axis in PCS2, also adding '$gun_rotation' as a subobject property.  I assume that setting this property allows the code to use the values $submodel_rotation_speed and $submodel_rotation_acceleration in weapons.tbl to define speed and acceleration... or not?

It doesn't work.

Also tried adding this to my ship entry in ships.tbl:
   $default PBanks:   ( "Gun" )
   $animation:      triggered
   $type:         primary_bank
   +sub_type:      0
   +delay:         0
   +absolute_angle:   180,0,0
   +velocity:         200,0,0
   +acceleration:      120,0,0
   +time:         2000

This doesn't work either.
Primary_bank will trigger when you select that primary bank, not when you Fire that primary bank
So for one, you would need at least two primary banks and switch between them to see any kind of animation.

$Subsystem: Gun, 1.0, 1.0  Do not forget to set a rotation speed for your subsystem in your ship table either.
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rotating Primary Weapons
Quote
second its probably gonna get pulled from the code base if someone (bobboau) doesn't work on it.
BS.
Too many things use the current animation code already. Unless someone makes a proper replacement for it, that stuff stays.

its called lua.


Quote
Quote
What I have tried:
Set up a submodel of the main model as 'gun', and set its rotation type (to 'rotate'... duh) and axis in PCS2, also adding '$gun_rotation' as a subobject property.  I assume that setting this property allows the code to use the values $submodel_rotation_speed and $submodel_rotation_acceleration in weapons.tbl to define speed and acceleration... or not?

It doesn't work.

Also tried adding this to my ship entry in ships.tbl:
   $default PBanks:   ( "Gun" )
   $animation:      triggered
   $type:         primary_bank
   +sub_type:      0
   +delay:         0
   +absolute_angle:   180,0,0
   +velocity:         200,0,0
   +acceleration:      120,0,0
   +time:         2000

This doesn't work either.
Primary_bank will trigger when you select that primary bank, not when you Fire that primary bank
So for one, you would need at least two primary banks and switch between them to see any kind of animation.

$Subsystem: Gun, 1.0, 1.0  Do not forget to set a rotation speed for your subsystem in your ship table either.

animation code != weapon models, stop confusing people!

really the best way to make it work is to look at a mod that already works.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
GOT IT!

Finally...  This is the problem, the weapon model can't just consist of a single object, it must be an invisible parent with a subobject that rotates...  Hence the table entries say 'subobject rotation' and not 'object rotation'... that makes sense too, must need a parent to generate relative angles etc. etc.

Now the only niggle is that is puts the weapon where your firepoint is, not where the gun subsystem is...  although this is something I can live with...  But means you can't have a firepoint offset from the centreline of your rotation weapon... oh well.

Hooray!  Thanks so much for all the info guys, really appreciate the time and effort put in to helping a noob like me!

M.
« Last Edit: May 21, 2010, 11:52:48 am by Mahak »

 

Offline Spoon

  • 212
  • ヾ(´︶`♡)ノ
Re: Rotating Primary Weapons
Quote
its called lua.
Yes, because everyone will suddenly and magically know how to script right?
Urutorahappī!!

[02:42] <@Axem> spoon somethings wrong
[02:42] <@Axem> critically wrong
[02:42] <@Axem> im happy with these missions now
[02:44] <@Axem> well
[02:44] <@Axem> with 2 of them

 

Offline Qent

  • 29
Re: Rotating Primary Weapons
Quote
its called lua.
Yes, because everyone will suddenly and magically know how to script right?
Nuke will teach them. :D

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rotating Primary Weapons
Quote
its called lua.
Yes, because everyone will suddenly and magically know how to script right?
Nuke will teach them. :D
i tend to give my students 30000 volts when they screw up

GOT IT!

Finally...  This is the problem, the weapon model can't just consist of a single object, it must be an invisible parent with a subobject that rotates...  Hence the table entries say 'subobject rotation' and not 'object rotation'... that makes sense too, must need a parent to generate relative angles etc. etc.

Now the only niggle is that is puts the weapon where your firepoint is, not where the gun subsystem is...  although this is something I can live with...  But means you can't have a firepoint offset from the centreline of your rotation weapon... oh well.

Hooray!  Thanks so much for all the info guys, really appreciate the time and effort put in to helping a noob like me!

M.

heres another hint, if you give the weapon model a primary gunpoint(s), it will fire from them.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Well f*** me sideways - so it does!  Thanks Nuke!

My next mission - getting the weapons to show up on the tech room ship model & in the weapon loadout...  I smell workarounds on the way...  Something like '$Tech Room Model' in ships.tbl would be nice (like in weapons.tbl), but hey, where there's a will, there's a way...

Once again thanks for all the help, fellas.

M.

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Rotating Primary Weapons
i never figured that one out, i had thought to override that screen with a lua hook and be able to do a custom loadout screen. but it seems like a lot of work without any real gain. a better solution is code some features into the engine to have those screens render default loadout (in case of tech room), or with selected loadout (loadout screen), such as that seen in the sensor gauge. i asked for them years ago but i guess they kinda got buried over the years.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

  

Offline Mahak

  • 25
Re: Rotating Primary Weapons
Yeah that sounds like a decent move - would fit in with existing architecture also (let me get this straight - I'm no coder), given that all the models are pre-loaded by this point, just needs something to slap the weapons on there.  But I'm sure there are hurdles, as there are in everything!

Might pop over to the feature request thread...