March 14, 2010, 01:46:49 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
   Home   Help Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: multipart turrets on angled surfaces  (Read 2294 times)
0 Members and 1 Guest are viewing this topic.
Vertigo 7
28

Offline Offline

Posts: 376


« on: January 10, 2009, 01:05:31 am »

can this be done? i thought that you could "define" the X Y and Z rotation
Logged
Wanderer
Wiki Warrior
211

Offline Offline

Posts: 3,220

Mostly harmless


« Reply #1 on: January 10, 2009, 02:26:58 am »

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)
Logged
Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #2 on: January 10, 2009, 03:34:05 am »

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)
Logged

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!"
Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #3 on: January 11, 2009, 11:31:43 pm »

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. 
Logged

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!"
Roanoke
210

Offline Offline

Posts: 1,829


« Reply #4 on: January 14, 2009, 04:37:35 pm »

I'd be surprised if Max doesn't already have some feature that allows a user to view & manipulate normals.
Logged
Talon 1024
29

Offline Offline

Posts: 588

Sometimes Wrong


« Reply #5 on: January 17, 2009, 10:01:13 pm »

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?
Logged

AKA KC-1024 | WCSaga website | WCSaga Forum | 158th website | 158th forum | WC: Hostile Frontier | WCHF Thread at CIC | Multipart turrets on angled surfaces, tutorial included. | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32) | Tell a story | Learning to program in Java | The cold hard truth about today's media industry.
Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #6 on: January 17, 2009, 11:26:05 pm »

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
Logged

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!"
Wanderer
Wiki Warrior
211

Offline Offline

Posts: 3,220

Mostly harmless


« Reply #7 on: January 18, 2009, 03:08:13 am »

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, 03:22:31 am by Wanderer » Logged
Talon 1024
29

Offline Offline

Posts: 588

Sometimes Wrong


« Reply #8 on: January 21, 2009, 11:11:10 pm »

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...
Logged

AKA KC-1024 | WCSaga website | WCSaga Forum | 158th website | 158th forum | WC: Hostile Frontier | WCHF Thread at CIC | Multipart turrets on angled surfaces, tutorial included. | To convert speeds from WC to WCS, multiply both the cruise speed and the Afterburner speed by 0.15625 (5/32) | Tell a story | Learning to program in Java | The cold hard truth about today's media industry.
Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #9 on: January 21, 2009, 11:53:10 pm »

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. 
Logged

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!"
Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #10 on: June 06, 2009, 03:52:35 pm »

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    I'll have an updated version uploaded soon.
Logged

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!"
FreeSpaceFreak
210

Offline Offline

Posts: 1,549

Ancient


« Reply #11 on: November 01, 2009, 03:39:53 am »

So, for a rear-facing turret, the uvec would point straight to the back... and the fvec as well?
Logged

Scooby_Doo
212

Offline Offline

Posts: 6,184

depressed


« Reply #12 on: November 01, 2009, 04:08:20 am »

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.
Logged

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!"
Vasudan Admiral
Member
211

Offline Offline

Posts: 2,483


WWW
« Reply #13 on: November 01, 2009, 07:38:02 am »

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.
Logged

Get the 3.6.10 Media VPs and report any bugs you find in them to the FSU Mantis! || Blender to POF model conversion guide
Twisted Infinities
FreeSpaceFreak
210

Offline Offline

Posts: 1,549

Ancient


« Reply #14 on: November 01, 2009, 03:14:12 pm »

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.

Logged

Aardwolf
Spoiled Derp!
211

Offline Offline

Posts: 2,693

Posts: 16,384


WWW
« Reply #15 on: November 01, 2009, 05:15:47 pm »

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.
Logged

The FreeSpace 2 RTS Mod

"Altruism, at least from my point of view, means doing something based on the notions you've accumulated all through your life of what's good and bad, rather than the base pleasure and pain that were used to instill those in you, as reward and punishment for conforming with the views of those who raised you" --me
Vasudan Admiral
Member
211

Offline Offline

Posts: 2,483


WWW
« Reply #16 on: November 01, 2009, 05:57:21 pm »

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.
Logged

Get the 3.6.10 Media VPs and report any bugs you find in them to the FSU Mantis! || Blender to POF model conversion guide
Twisted Infinities
Bobboau
Just a MODern kinda guy
Just MODerately cool
And MODest too
213

Offline Offline

Posts: 9,837


« Reply #17 on: November 02, 2009, 01:52:53 am »

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.
Logged

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 divers sorts, [as] of woollen and linen together
Vasudan Admiral
Member
211

Offline Offline

Posts: 2,483


WWW
« Reply #18 on: November 02, 2009, 03:05:17 am »

Nice. Big grin
Logged

Get the 3.6.10 Media VPs and report any bugs you find in them to the FSU Mantis! || Blender to POF model conversion guide
Twisted Infinities
FreeSpaceFreak
210

Offline Offline

Posts: 1,549

Ancient


« Reply #19 on: November 03, 2009, 02:53:57 pm »

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)
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!