Page 1 of 1

How to determine the up and forward vector of a subunit

Posted: Tue Sep 25, 2007 9:07 pm
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.

Posted: Tue Sep 25, 2007 9:41 pm
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.

Posted: Wed Sep 26, 2007 10:39 am
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

Posted: Wed Sep 26, 2007 11:18 am
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 :-)

Posted: Wed Sep 26, 2007 10:13 pm
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

Posted: Mon Sep 01, 2008 8:24 am
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. :(

Posted: Mon Sep 01, 2008 2:58 pm
by loki1950
The plug-in is stuck on an earlier version of Winds3D just won't work with any current version.

Enjoy the Choice :)