Author Topic: any chance at gatting the lookat feature back?  (Read 1692 times)

0 Members and 1 Guest are viewing this topic.

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
any chance at gatting the lookat feature back?
anyone remember that look at feature for subobjects that was lumped onto bob's turret upgrades? it was for simulating haydraulic pistons and such for animation. im finally able to do some modeling for nukemod again and ive come up with a couple ideas for how to do certain animations which would require that feature. sence it really didnt have anything to do with turrets i was wondering if we could get that feature back into head without screwing anything up?

if this is not possible, id like tosee the code for this feature would be so i can do the same thing in scripting.
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 Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: any chance at gatting the lookat feature back?
the trick to it was finding object B's position int object A's reference frame, th easiest way to do that would be to get B's position in object space and transform with A's matrix, but I'm not sure if you can get all that in the right way with the scripting system.

my code for this is in CVS history if anyone does want to take a stab, but I'd recommend coming up with an off axis subobject solution first, cause that makes everything more useful.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any chance at gatting the lookat feature back?
i should be suffietiently familiar with matrix math by now to figure out how to do that.

i could probibly get b's position and subtract a's pos from it to draw a vactor between the parts, use vector:getOrientation() to give me a matrix and set the orientation for object a to that matrix. this should work with objects on a plane or objects with z axis radial symetry in multiple planes. though im not sure if .position takes into account any displacement caused by the moving of its parent. anyway im probibly gonna have to test the crap out of any scripting concoction i come up with :D
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: any chance at gatting the lookat feature back?
Quote
    lvector Position
        Subsystem position with regards to main ship

So no. It is just the displacement of the subsystem from the center of the ship.

That reminds me that .Position needs to be reworked to work properly. Right now if you change it you actually change the position in the model data, which means that the subsystem position will change for all ships of that type, not just the ship it is applied to. That was supposed to cause problems with the collision code so I never fixed it myself.
-C

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
Re: any chance at gatting the lookat feature back?
in that case is have to (un?)rotate the position data from a (and possibly b as well if its parent moves) by its respective orientation, then i can draw the line from a to b. then id have to set a to its parents rotation matrix * the rotation matrix generated by getting the a-to-b vector's orientation via v:getOrientation() (or vice versa, multiplication order matters). i think :D

anyway all i really need to do is come up with a matrix for a and b so that the parts meet up. im probibly gonna end up reading the matrix tutorial over at gamedev (for like the 5th time) on this one.

anyway i always wondered what would happen if you changed a subobjects .Position. does the same apply if i change a subobject's .Orientation? i dont think ive seen any other ships inherit turret angles from alpha 1 whilst testing my turret scripts, but then again i wasnt looking for it.
« Last Edit: September 21, 2007, 10:32:23 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

  

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
Re: any chance at gatting the lookat feature back?
the way to get this feature to work is once you have B's position in A's frame of reference, you project B's position into A's and figure out the angle you'd need to rotate A by so that it would be pointing at B.

but like I said finding B relative to A taking into account all the rotations and stuff of both of the objects is the tricky part.
Bobboau, bringing you products that work... in theory
learn to use PCS
creator of the ProXimus Procedural Texture and Effect Generator
My latest build of PCS2, get it while it's hot!
PCS 2.0.3


DEUTERONOMY 22:11
Thou shalt not wear a garment of diverse sorts, [as] of woollen and linen together