Modding, Mission Design, and Coding > The Scripting Workshop

Turrets, Orientation, and Vectors

(1/2) > >>

Nuke:
is there any way to convert vectors to orientations and vice versa? there were a cople functions in quake c which did this and i found them very usefull.

Wanderer:
Like these?

orientation:unrotateVector(vector)
orientation:rotateVector(vector)

Nuke:
i mean give an x,y,z and return a p,b,h. and the inverse of giving a p,b,h and returning a normalized vector pointing in the same direction. is that what those do?

Wanderer:
Well as vector object has more degrees of freedom than the orientation object its not possible to convert those directly (perhaps a direct function for that might do it) back and forth. However those functions that i named can be used to change vectors respective to the set orientation.

For example (i always forget which function did which)..

Make new vector object (0,0,1) and then unrotate (or rotate) that vector with the ships orientation and it ought to point exactly along ships front vector (with length of one). Same with (1,0,0) and (0,1,0) vectors and you get all needed coordinates needed.

Nuke:
my main reason i need it is when i manupulate subobjects, whos rotations are all stored in p,b,h formats. say i need to rotate a subobject so that it points in a particular position in space. a normalized vector is adequit and i can use its position to gauge distance and then multiply the magnitude by that distance with the converted vector to cover that. il play around with those functions some more they might do what im looking for.