Author Topic: multipart turrets on angled surfaces  (Read 17304 times)

0 Members and 1 Guest are viewing this topic.

multipart turrets on angled surfaces
can this be done? i thought that you could "define" the X Y and Z rotation

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: multipart turrets on angled surfaces
I think this has already been described in IRC but...

Some of the work needs to be done in some modelling application and some while the subobject properties. First you just need to know the uvec (ie. surface normal of the turrets location) and fvec (turrets front vector. These can be determined in number of ways, most often this means that you can handle basic trigonometry.

Also the turret should also be placed (while modelling) so that it faces the fvec AND has barrels in 90 deg elevation (ie. pointing along uvec)
Do not meddle in the affairs of coders for they are soggy and hard to light

 
Re: multipart turrets on angled surfaces
I've written a program that'll help generate the uvec and fvec. I'll get it uploaded sometime soon.  (BTW it does require .Net 2.0)
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 
Re: multipart turrets on angled surfaces
Here you go: http://scoobydoo.freespacemods.net/Completed/Angle2VectorConverter.exe

It's ready for 3dmax usage (or any app where Z is up/down) and for those still using the old truespass cob method.

The angle of the turret is the "Rotation", if the original turret isn't facing up forward (i.e. it's original angle isn't at 0,0,0) then add "turret origin".
i.e. The most common case: if you made a turret facing up-forward then rotated it to it's correct angle on the hull of let's say (20,0,0) then rotation would be (20,0,0) and turret origin would be (0,0,0). 


I'm not make any guarantees that it's 100% correct. 
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Roanoke

  • 210
Re: multipart turrets on angled surfaces
I'd be surprised if Max doesn't already have some feature that allows a user to view & manipulate normals.

 

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: multipart turrets on angled surfaces
Sorry, I don't regularly visit the IRC channel, so I don't know how to do this, or if it is already in the code.

How do I set the turret rotation? is it defined in the tables or the model itself?
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 
Re: multipart turrets on angled surfaces
Sorry, I don't regularly visit the IRC channel, so I don't know how to do this, or if it is already in the code.

How do I set the turret rotation? is it defined in the tables or the model itself?


It's in the pof model, on the subsystem. It's $uvec and $fvec
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: multipart turrets on angled surfaces
Step 1.
When placing the turret on to the ship in some modeling proggie make sure the turret model's front points to the desired front vector (future fvec) direction and that the barrels are in 90 degree elevation (pointing along the desired up vector or uvec).

Step 2.
Use whatever means possible to gather the data required to set up the fvec and uvec. There are utilities (like what Scooby posted, one hopefully soon to be released MAXscript or some other utility), or determine the vector by some other means (like using dummy objects with modeling program), or then by trial and error.

Step 3.
Input the data to the subobject properties box when editing pof data (with for example PCS2). Most likely last entries of that particular subsystem.
Quote
$uvec:x,y,z
$fvec:x,y,z

Step 4.
Setup the animation code part of that subsystem entry in ships.tbl to what ever default you want the barrels to point to.
« Last Edit: February 01, 2009, 02:22:31 am by Wanderer »
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Talon 1024

  • 29
  • How do you turn this on?
    • Mods, Games, and Stuff
Re: multipart turrets on angled surfaces
Thanks for the tutorial, Wanderer.  I'm going link to this thread in my sig, for future reference.

@Scooby Doo: I don't understand what the "Turret origin" is...
To understand religion, you need to understand morality first. | WCSaga website | WCSaga Forum | 158th website | 158th forum | Project Leader: WC: Hostile Frontier | WCHF Thread at CIC | Wing Blender | Twist of Fate | Multipart turrets on angled surfaces, tutorial included. | My Google Drive stuff | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32)

FS2 Mods I'm waiting on: Inferno 10th Anniversary
Current Project: Contestant Android app, Learn4Life iOS app, Blender Commander (importer).
The FreeSpace Font Foundry is back in action!

 
Re: multipart turrets on angled surfaces
Turret origin is usually (0,0,0).  If you designed your turret so it's facing up forward it'll be 0,0,0.  In the odd case you designed the turret facing down it'll be 0,180,0 (i think).

Basically this is the angle required to bring the turret so it's facing up forward, if it's already up facing forward then theres no angle offsets needed.  :)
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 
Re: multipart turrets on angled surfaces
Just a heads up, my app won't run in Win7 64bit (i dunno about vista 64).   It'll run but when you hit calc it'll crash complaining about bad image.  Something to do with DirectX Vector3  :confused:  I'll have an updated version uploaded soon.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 
Re: multipart turrets on angled surfaces
So, for a rear-facing turret, the uvec would point straight to the back... and the fvec as well?

 
Re: multipart turrets on angled surfaces
The uvec would be facing back, the fvec (forward) would be either straight up or straight down (depending on how you setup the turret).  Think of forward vector as the vector where the front of the turret is facing.

edit: oh and ya, I've updated the program several months ago.
That's cool and ....disturbing at the same time o_o  - Vasudan Admiral

"Don't play games with me. You just killed someone I like, that is not a safe place to stand. I'm the Doctor. And you're in the biggest library in the universe. Look me up."

"Quick everyone out of the universe now!"

 

Offline Vasudan Admiral

  • Member
  • 211
    • Twisted Infinities
Re: multipart turrets on angled surfaces
Photo group demonstration of Fvec and Uvec!
http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/BlenderTutorialStuff/VectorTurret1.jpg
http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/BlenderTutorialStuff/VectorTurret2.jpg
http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/BlenderTutorialStuff/VectorTurret3.jpg
http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/BlenderTutorialStuff/VectorTurret4.jpg
http://i5.photobucket.com/albums/y184/VA--Twisted_Infinities/BlenderTutorialStuff/VectorTurret5.jpg

So, the Uvec always points straight up out of the turret, and forms the axis the turret base rotates around.

The Fvec is to tell FS where the front of the turret base IS facing - as in, you match it to the direction the arms ARE pointing rather than pointing it off in some other weird direction you would like them to face, where FS will have no idea what you're talking about and your arms will do stupid things like rotate around false axes.

As for how to get those vectors, I still reckon the easiest way is in PCS2 with 2 gunpoints. Place both gunpoints in the centre of rotation for the turret base, and begin entering whatever numbers you like in the normal field till you get the hang of how they work if you don't already know. Point one up out of the turret along the turret base' rotation axis, and point the other in the direction the turret base is facing. Press the "Norm" button to normalise (make equal to 1 unit long) those normals, and now you have your three X, Y and Z values for each vec. :)
Get the 2014 Media VPs and report any bugs you find in them to the FSU Mantis so that we may squish them. || Blender to POF model conversion guide
Twisted Infinities

 
Re: multipart turrets on angled surfaces
So what if you have an empty for turret base, does it matter where you point the fvec to? Should it be in the plane normal to the uvec?
The turret is mounted on the tail of a bomber, pointing straight rear by default.


 

Offline Aardwolf

  • 211
  • Posts: 16,384
    • Minecraft
Re: multipart turrets on angled surfaces
does it matter where you point the fvec to? Should it be in the plane normal to the uvec?

Yes. The fvec and uvec should always be perpendicular.

 

Offline Vasudan Admiral

  • Member
  • 211
    • Twisted Infinities
Re: multipart turrets on angled surfaces
I don't know how strict that 'perpendicular-ness' rule is, so I wouldn't worry about how accurate you are there, BUT I don't think you can use an empty as FS hierarchy - use a tiny internal cube or something instead.
Get the 2014 Media VPs and report any bugs you find in them to the FSU Mantis so that we may squish them. || Blender to POF model conversion guide
Twisted Infinities

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: multipart turrets on angled surfaces
as long as the two vectors aren't the same it should be fine, uvec has priority, fvec will be projected into the proper plane (defined by uvec), there is also an rvec that gets automajicaly calculated.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Vasudan Admiral

  • Member
  • 211
    • Twisted Infinities
Re: multipart turrets on angled surfaces
Nice. :D
Get the 2014 Media VPs and report any bugs you find in them to the FSU Mantis so that we may squish them. || Blender to POF model conversion guide
Twisted Infinities

 
Re: multipart turrets on angled surfaces
Guh... I must be doing something wrong... The turret is there, but it's not firing... And it seems to be indestructible as well... Anyone willing to take a look? Download

(Placeholder textures and table, obvoiusly)