Home   Help Search Login Register  

Author Topic: VectorDir and VectorUp  (Read 1232 times)

0 Members and 1 Guest are viewing this topic.

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
VectorDir and VectorUp
« on: 20 Mar 2007, 11:56:13 »
As these two new commands are pretty poorly explained in BIS Wiki, I'll try to bring here a bit of light about them as well as the starting point of a deeper discussion.

Note that my following conclusions may be wrong or even extremely wrong  :P

what's direction vector? spatial 3D vector defining the moving direction of an object relative to the world. The lenght of that vector is 1, and each of their components goes from -1 to 1.

So, lets say we have an AV8B flying to NE (dir = 45) and climbing in a 25 degrees substained climb.

_vectorlength = 1
z = sin (25)*_vectorlength
_horizontalvectorlength = cos(25)*_vectorlength
x = sin (45)*_horizontalvectorlength
y = cos(45)*_horizontalvectorlength

AV8 direction vector would be [x,y,z]


what's direction vector? spatial 3D vector defining the UP (upper) side of an object relative to the object's "face".

For example, the "face" of a car is its forward side, when you get into a car, you are looking straight forward. So the upper side of the car when standing still over the ground is its top. Which means the UP vector would come from the car's top towards the sky [0,0,1] (relative to its "face" vector, which depends on its real direction. Now we pick up that car and drop it from 1000m. Initially, its "face" will be looking foward, and the UP side will be its top. But as the car falls down, its face will start pointing to the ground, and its back will start pointing to the sky. When the car is facing the ground while falling, the UP side is no more its top, but its back. So the up vector will come from its back towards the sky. In this case, the up vector is just opposite to the "Face" vector (not perpendicular as in first situation), and the "face" vector will be the same as the dir vector, falling down, and looking at the ground. Note that since the car was left in the sky, its direction vector has been always [0,0,-1] while its up vector has been changing as the car gets the final nose-down attitude. Now, the Up vector would be [sin(180), cos(180),0] or [0,-1,0] relative to the face vector [0,0,-1], just pointing in the opposite direction relative to the car's "face".

Now I also believe that Up vector is (as dir vector) a vector of length = 1.


EDIT:
Another example with the falling car. If the car falls down nose up, its "face" vector and the UP vector will be the same (0 degrees diferente in elevation and 0 degrees difference in the "face"'s plane. So, in this case, the up vector would be [sin(0), cos(0), sin(0)] or [0,1,0], while the dir Vector would still be [0,0,-1] (falling down, looking up).

Feel free to correct me and/or add more info about this topic  ;)
« Last Edit: 20 Mar 2007, 13:13:52 by Mandoble »

Offline Cheetah

  • Former Staff
  • ****
Re: VectorDir and VectorUp
« Reply #1 on: 20 Mar 2007, 22:52:51 »
I'd like to add that when using these Vector commands, take into account that once you've achieved your beatiful vector - with the car facing the stars in a 60 degree angle watch out with changing the direction it's spawned. I experienced that I didn't know enough about the vector commands, because I had the stone wall object in a perfect position, that is laying on it's side instead of standing normal and wanted to copy paste this one and change the direction when needed. It didn't work out as I planned, predictable though after giving it another thought.

In my opinion, more resource, probably a VectorStudio - a dialog which enables you to set the vector / position / direction of an object - to make using these commands easier for people who don't want to spent a lot of their time on studying the Vector commands themselves. For people interested, a tutorial or resource could / should be made so that they can get an idea of how this vector thing works and what's it relative to, plus how changing the values would affect the position of an object.
Like missions? Help with Beta Testing! or take a look at the OFPEC Missions Depot for reviewed missions!