Author Topic: Fvec goes where? And how?  (Read 3614 times)

0 Members and 1 Guest are viewing this topic.

Offline Mahak

  • 25
Fvec goes where? And how?
Ok, so trawling through the forums and modding portal, I can't seem to find a good explanation of how fvec & uvec are used.  I know WHAT they do, but the HOW is a little confusing...

My current assumption  is:
- Defined in subobject properties of PCS2 - in the turret base properties area (along with $fov etc. etc.)
- Co-ordinates are -x,y,z is PCS2?  And not in degrees...  so what is it in?
- Can be overridden by table info, the phase of the moon, or ghosts
- Doesn't work

Explanation - trying to set up some multipart turrets with a limited field of fire, sticking out 90 degrees from a ship hull (kind of like a broadside cannon).

Have tried multiple different orientations of export, frozen & unfrozen rotation info, animation code in the table file etc. etc.  So far everything I try simply ends up with the turret firing forwards, no matter what (and the visual doing all sorts of things - barrels rotation all over the place etc. etc.

As I said, I usually trawl the forums until I find the solution, but so far have come up empty.  Can't even seem to find fvec values or anything on original freespace2 models!~

Anyone able to help?

M.

 

Offline The E

  • He's Ebeneezer Goode
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Re: Fvec goes where? And how?
fvec and uvec are entered as submodel properties in PCS2. Note that you always need both. They take the form of three-component vectors, i.e. $fvec=0,0,1 for example.

To see a model with these properties set, you need one from a mod (as this whole business is an SCP addition); I would recommend the Solaris from BP:WiH.

In order to constrain a turrets' fov, please refer to this wiki page.
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 zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Fvec goes where? And how?
- Defined in subobject properties of PCS2 - in the turret base properties area (along with $fov etc. etc.)

Correct.

- Co-ordinates are -x,y,z is PCS2?  And not in degrees...  so what is it in?

The values represent a normalized local vector. That is, exactly like turret/eyepoint/thruster normals are supposed to. If in doubt, you can always create the vector of your choosing using the turret/eyepoint/thruster normal editing boxes, and then copy the result to your $fvec and $uvec props (just remember to change : to ,).

- Can be overridden by table info, the phase of the moon, or ghosts

Nope, can't be overridden anywhere.

Explanation - trying to set up some multipart turrets with a limited field of fire, sticking out 90 degrees from a ship hull (kind of like a broadside cannon).

Have tried multiple different orientations of export, frozen & unfrozen rotation info, animation code in the table file etc. etc.  So far everything I try simply ends up with the turret firing forwards, no matter what (and the visual doing all sorts of things - barrels rotation all over the place etc. etc.

As I said, I usually trawl the forums until I find the solution, but so far have come up empty.  Can't even seem to find fvec values or anything on original freespace2 models!~

Anyone able to help?

M.

For a turret which is on the left side of the ship (turret's up vector points to the left) pointing forward (forward vector points forward), then you want this (assuming you want the turret to have a 180 degree hemispherical FOV):

Code: [Select]
$fvec: 0.0,0.0,1.0
$uvec: -1.0,0.0,0.0
$special=subsystem
$fov=180

Worth noting is that PCS2 (and/or the pof format itself) uses reversed x axis coordinates. So the position (offset) coordinates of your left-side turret probably have a positive x component, but in the turret vecs negative x means left and positive x means right.

The $fov prop works so that if you want the turret to able to lower its barrels lower than horizontal (from the turret's POV), then you want values higher than 180, and if you want the barrels to not be able to reach even horizontal level, then you want a lower value. Works for either multiparts or singleparts. To limit the rotation of the turret's base or the maximum elevation of the barrels, look at the Subsystem page.

Finally, a couple of things which will save you some time: firstly, the rotation axis doesn't need to be set (I think it's only needed for submodels which use $rotate or $dumb_rotate) and secondly, turret normals don't need to be set for multiparts which have $fvec and $uvec.

 

Offline Mahak

  • 25
Re: Fvec goes where? And how?
Thanks for your replies folks!  As usual, the HLP forums are chock-full of helpful people!

I suspect that my problem is that I need to define both uvec & fvec...

So, if I define the fov as, say, 90, then the turret will only lower its barrels from fully upright (as far as I know, this is the correct way for turrets to be exported - with the barrels standing up at 90deg to the turret base) to about 45 degrees in a kind of 'cone' area?  Hmmm... Not exactly what I had in mind.  But its a start.  I guess use of $Maximum Barrel Elevation $Turret Base Rotation in the tbl file might fix that kind of thing.

I guess my other question is whether the turret should be exported facing forward (in which case fvec & uvec will orient it the correct way) or do I export it facing the correct way (and uvec/fvec will tell the engine which way my turret IS facing)?  Oh, just for reference, it's kind of the opposite of what you mentioned as an example: uvec=up, fvec=90 degrees (pointing out the side).  Think of broadside cannons on an old sailing ship.  But with some limited aiming/tracking.

Will report back with success/fail!  Once again, its awesome to know that if I really get stuck with a problem, someone around here knows their s#$t!

M.

« Last Edit: January 21, 2012, 03:20:44 pm by Mahak »

 

Offline Trivial Psychic

  • 212
  • Snoop Junkie
Re: Fvec goes where? And how?
If I may tag on a secondary question...  When it comes to non-traditional placed multipart turrets, that is... not perfectly straight up or straight down barrels and y-axis aligned bases, is it more convenient for setting up the uvec and fvec, that is... determining the proper figures, when the barrels are created perfectly vertical relative to the base, perfectly vertical relative to the ship, or does it matter?
The Trivial Psychic Strikes Again!

 

Offline Mahak

  • 25
Re: Fvec goes where? And how?
Ok, so I tried this:

$fvec=1,0,0
$uvec=0,1,0

Tried exporting turret facing both forward & facing to the right.

STILL only targets the player in an arc facing forward, no matter how I export it.  The only difference is that when exporting facing to the right, all the turret base/barrel orientations screw up.  I seem to recall fs2 wants all your turrets facing forwards (or backwards if they are on an underside).  Is this true?  AM I MISSING SOMETHING OBVIOUS?

Its like fvec & uvec are being completely ignored!  I wonder if I have a problem with PCS2?  I AM using a collada version, which is not 100% tested I think...

EDIT: Don't think its PCS2 - re-opened the POF, uvec & fvec info is still there in the subobject props...

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Fvec goes where? And how?
Do what I said, not what The_E said: use : instead of =. :D

 

Offline Mahak

  • 25
Re: Fvec goes where? And how?
Winning!

Who would have thought?  fvec & uvec use ':'... unlike all other subobject properties which use '='!  Syntax!  My arch-nemesis!

Just a few turret rotation issues - nothing I can't handle.  All works brilliantly!  Now if I could only trick Maya to let me define the subobject properties as helper nodes... (Maya won't allow you to name any objects using non-standard characters, like =, $ etc. etc.)  I have to re-enter all the fvec & uvec info for all my turrets in PCS2 every time I export a new version of the model!  D'oh!  Ah well, can't win 'em all, Charlie Sheen.

Thanks for your help folks.

M.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Fvec goes where? And how?
Well, when exporting from Max one can just put the submodel props in the object's "user defined properties" and they'll carry over to PCS2 just fine, when exporting as a .dae. Surely Maya has something similar, although I suppose the properties might not survive exportation to all formats.

 

Offline Mahak

  • 25
Re: Fvec goes where? And how?
If I may tag on a secondary question...  When it comes to non-traditional placed multipart turrets, that is... not perfectly straight up or straight down barrels and y-axis aligned bases, is it more convenient for setting up the uvec and fvec, that is... determining the proper figures, when the barrels are created perfectly vertical relative to the base, perfectly vertical relative to the ship, or does it matter?

Pretty sure they should be kept vertical relative to the base of the turret, not the ship.  But I have not had to align any turrets on strange angles - pretty much everything I have done rotates on the y axis relative to the ship.

And yes, I'm searching for some kind of user defined properties like max has... I'm sure there is something you can do in Maya like this, its just a matter of finding it and testing it!  You have given me an idea though - perhaps using that particular phrase (user defined prop.) might be enough for PCS2 to pick it up...

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Fvec goes where? And how?
Yes, multipart turrets should always be exported with their barrels pointing straight up relative to the turret base. Or at least that's how it's usually done; it might be possible to do it otherhow, but I wouldn't know anything about that.

 
Re: Fvec goes where? And how?
You can set their resting position ingame if you don't like them jutting straight up by putting $Triggered: in the turret subobject property, and then tabling the turrets like so:  http://www.hard-light.net/wiki/index.php/Animation_Code

Anyways, does someone mind explaining to me exactly how to set up the fvec/uvec helpers in 3DSMax? 

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Fvec goes where? And how?
You can set their resting position ingame if you don't like them jutting straight up by putting $Triggered: in the turret subobject property, and then tabling the turrets like so:  http://www.hard-light.net/wiki/index.php/Animation_Code

Actually you don't need to use $Triggered: for turrets; at least the initial animation type works for them even without it.

Anyways, does someone mind explaining to me exactly how to set up the fvec/uvec helpers in 3DSMax?

Well, if you're using Max then I'd suggest simply using my turret setup script.

The other way would be to link an object called "helper" to the turret, and then link an object called "vec" to said helper. Give the "vec" object whatever orientation you desire, and PCS2 should then translate that orientation into the appropriate $fvec: and $uvec: values when you import the model.

 

Offline Mahak

  • 25
Re: Fvec goes where? And how?
The other way would be to link an object called "helper" to the turret, and then link an object called "vec" to said helper. Give the "vec" object whatever orientation you desire, and PCS2 should then translate that orientation into the appropriate $fvec: and $uvec: values when you import the model.

This would totally work for Maya too - thanks!  Had not seen this in any of the tutorials... tho I suspect the modelling/model export tutorials could probably use some updating by now...

  

Offline Mahak

  • 25
Re: Fvec goes where? And how?
Hmmm... obviously not.  I suspect that the method you describe (using a dummy called vec) just tells your exporter script what to do...

Might have to chat to spicious or someone who knows how the collada pcs2 works... I suspect that some code might need to be adapted for this to work with maya.  I've tried adding user defined data all over the place by many different methods, but it fails to be picked up by PCS2.  Ah well.