How to determine the up and forward vector of a subunit

This is the location for all mods to collaborate. Anyone making or planning their own mod should post help requests, screen shots and news here.

Moderators: Omega, tillias, Mod Contributor

How to determine the up and forward vector of a subunit

Postby Beowulf » Tue Sep 25, 2007 2:07 pm

I'm trying to fit turrets to a ship at the moment and have no idea how I should determine the up and forward vector. The up vector obviously is the normal vector of the face I want to attach the turret to but how do I get the values for this vector in blender or wings3d? The forward vector would have to be orthogonal to the normal vector and aligned with the zx plane. Again no idea how to get the values in blender or wings3d though I might be able to calculate the second vector from the first if I think hard enough about it... ;)
Any help on this would be greatly appreciated.
Last edited by Beowulf on Tue Sep 25, 2007 2:43 pm, edited 1 time in total.
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
Beowulf
Mercenary
Mercenary
 
Posts: 121
Topics: 34
Joined: Thu Jan 15, 2004 10:42 am

Share On:

Share on Facebook Facebook Share on Twitter Twitter Share on Digg Digg

Postby ace123 » Tue Sep 25, 2007 2:41 pm

I think in the Wings3D XMesh export plugin you specified mounts by adding something like a point or direction light.

Really, I'm not sure how this works...
One possibility would be to make the polygon with the turret a certain material, and then look in the XMesh for the polygon in a different material.
ace123
Lead Network Developer
Lead Network Developer
 
Posts: 2560
Topics: 32
Joined: Sun Jan 12, 2003 2:13 am
Location: Palo Alto CA

Postby Dilloh » Wed Sep 26, 2007 3:39 am

I don't know how this works within Wings3D or Blender, but you can easily reangle the values within units.csv. For example, here is the turret file for the PR1.2 Centurion:
Code: Select all
{mediumrear_blank;0;-.005;-0.390673;0;0;-1;0;1;0;90.0}

The line defines the following values:
{file;x;y;z;forex;forey;forez;upx;upy;upz;restricted}
play around with those values, but my guess is (w/o guarantee):
xyz is the position on the ship
forexyz is the position where the "nose" shall point to
upxyz is how far it can turn
restricted = no idea
User avatar
Dilloh
Elite Hunter
Elite Hunter
 
Posts: 1149
Topics: 25
Joined: Mon Aug 14, 2006 8:56 am
Location: Black Forest, Germany

Postby Beowulf » Wed Sep 26, 2007 4:18 am

I know what these values do, I'm looking for a mathematically precise way to get the values for the fore and up vectors. I think I'll have a solution for this in the evening. If I'm not mistaken restricted tells the turret how far it can turn (usually this would be 180 degrees for a turret).
Thanks for the help :-)
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
Beowulf
Mercenary
Mercenary
 
Posts: 121
Topics: 34
Joined: Thu Jan 15, 2004 10:42 am

Postby Beowulf » Wed Sep 26, 2007 3:13 pm

I've made a little openoffice calc spreadsheet that calculates the values for the forward and up vector if you give it three points in space that define the plane on which you want to place your turret:
http://www.hawo.stw.uni-erlangen.de/~si ... turret.ods
"History is on the move, Captain. Those who cannot keep up will be left behind, to watch from a distance. And those who stand in our way, will not watch at all."
Grand Admiral Thrawn
Beowulf
Mercenary
Mercenary
 
Posts: 121
Topics: 34
Joined: Thu Jan 15, 2004 10:42 am

Postby TBeholder » Mon Sep 01, 2008 1:24 am

Beowulf wrote:I'm trying to fit turrets to a ship at the moment and have no idea how I should determine the up and forward vector. The up vector obviously is the normal vector of the face I want to attach the turret to but how do I get the values for this vector in blender or wings3d?
I suspect that it's desirable (maybe even necessary) to have normalized vectors (length=1) there, but did not researched question in code.
But it's very simple. Place 1x1x1 cube at the surface where you want to add turret, and it's top face will look "up". Turn cube around one of edges perpendicular to that surface (or normal to surface as such) until one of its faces looks "forward". Now you have 4 edges perpendicular to "up" face for choice as a ready normalized "up" vector and another 4 edges perpendicular to "forward" face are all equal to normalized "forward" vector.

In Wings3D: select some face on ship -> "save BB" -> create 1x1x1 cube -> select any face on it -> "move to BB / all" -> select entire cube, vertices mode -> turn / around selection (faces mode, select "up" or "down" face | edge mode and select "up" edge), then you can select single edge of cube and see its components (XYZ). Rather long description, but once base face is selected, vectors are only few mouse clicks and/or pressed keys away. :)
I don't know Blender controls yet, but i saw there's some measuring plugins, so if you can place unit cube properly, you'll get vectors too.
ace123 wrote:I think in the Wings3D XMesh export plugin you specified mounts by adding something like a point or direction light.
And they accuse me of practicing necromancy! :twisted: That plugin appears to have rigor mortis. :(
"Two Eyes Good, Eleven Eyes Better." -Michele Carter
User avatar
TBeholder
Elite Venturer
Elite Venturer
 
Posts: 748
Topics: 38
Joined: Fri Apr 14, 2006 7:40 pm
Location: chthonic safety

Postby loki1950 » Mon Sep 01, 2008 7:58 am

The plug-in is stuck on an earlier version of Winds3D just won't work with any current version.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 18/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and DELL E6400 4GB ram/100 GB HD Mint 17.3 6
User avatar
loki1950
The Shepherd
 
Posts: 5734
Topics: 51
Joined: Fri May 13, 2005 1:37 pm
Location: Ottawa



Return to General Modding

Who is online

Users browsing this forum: No registered users and 1 guest

cron