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

Post Reply
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

How to determine the up and forward vector of a subunit

Post by Beowulf »

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 9: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
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

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.
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

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
Beowulf
Mercenary
Mercenary
Posts: 121
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

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
Joined: Thu Jan 15, 2004 5:42 pm

Post by Beowulf »

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
TBeholder
Elite Venturer
Elite Venturer
Posts: 753
Joined: Sat Apr 15, 2006 2:40 am
Location: chthonic safety

Post by TBeholder »

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
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

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 19.2/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 Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Post Reply