Author Topic: Turrets, Orientation, and Vectors  (Read 2934 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Turrets, Orientation, and Vectors
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.
« Last Edit: January 21, 2007, 10:47:32 pm by WMCoolmon »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Latest Builds of Interest
Like these?

orientation:unrotateVector(vector)
orientation:rotateVector(vector)
Do not meddle in the affairs of coders for they are soggy and hard to light

  

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Latest Builds of Interest
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?
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Latest Builds of Interest
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.

Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Latest Builds of Interest
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.

I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Latest Builds of Interest
well i guess rotate and unrotate have alot of uses and can do some of what i need. be nice if i could create a matrix from scratch (without a masters in calculus). i think my big problem is i cant do my remote turret stuff. im curious if its a bug or just that i suck at math. would be nice if i could get direct acces to the gun normal, rather than deal with matrix based aiming.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
Re: Turrets, Orientation, and Vectors
Split the thread. :p I also added a getOrientation() function to CVS, to the vector object. It'll take the vector as an fvec and pass it along to FS2's builtin function. It will create an internal normalized version of the vector regardless of whether it's actually normalized or not.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Turrets, Orientation, and Vectors
cool, im sure i can find many ways to use it.
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: Turrets, Orientation, and Vectors
well my turret code is getting pretty complicated. it works well but if im to command more that 5 turrets at once im gonna need to simplify my math. i  have a problem distinguishing between single part and multipart turrets. also setting the subsystem.Orientation and subsystem.GunOrientation will never guarantee that your turret will fire properly when commanded.

now i currently use mn.createWeapon() to kinda get around this. then i relized that you could kill all 3 birds with one stone by adding just one more turret var. along with Orientation and GunOrientation, i propose you add subsystem.Normal. it would be the actual firing normal of the turret at the time (not the static normal from the model, but rather the rotated vector the turret will fire along).

how does it kill 3 birds. well make it so that if the turret is a singlepart, GunOrientation comes up nil. then i can check to see if theres a gun object there before i start rotating submodels. it would reduce the math required a great deal if i didnt have to plot a normal for mn.createWeapon() to create a whole new gun. rather could simply use fireWeapon() to have the engine handle firing. also im not sure if mn.createWeapon()  allows me to use beams, flaks, or missiles, which would be usefull for capship command missions.
« Last Edit: February 21, 2007, 01:26:36 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN