Author Topic: Hey, he can't do that!  (Read 14804 times)

0 Members and 1 Guest are viewing this topic.

Offline WMCoolmon

  • Purveyor of space crack
  • 213
I think what he meant is that right now you only have a "distance from center" box. But a gun point could be translated anywhere (and I feel like a dumbarse for not realizing this before) along the x, y, and z axis, and all of those would mean different normals. If you have a gun point 20 meters from center, is it 20 meters vertically, horizontally, or forward/back?

So what I said before is incomplete. The calculations should be the same for x and z, but you will also need to calculate the normalized 'y' component too, so the guns will tilt up or down if they're moved up or down.

So you need three cells for 'gunpoint offset from center'. Here:



As you can see, even though the red gunpoint in "2" is the same distance as the red gunpoint in "3", the normal vector values are different because the one in "3" is moved to the right, while the gunpoint in "2" is moved back from the center. Also note that while both gunpoints in "3" are 1m to the right of the center of the spacecraft, the angle is slightly different for the pink gunpoint because it is also moved back 1 meter. "4" shows the distances I used for the calculations.

That same graph above could be used for y values. Rotate it to the left 90 degrees, and swap the "x" and "y" values; the z values will remain the same. (assume a conical spacecraft :p)



I wasn't too careful with the calculations so they could be wrong, but the signs and general magnitude look OK.
« Last Edit: December 13, 2007, 04:05:53 am by WMCoolmon »
-C

 

Offline Bobboau

  • Just a MODern kinda guy
    Just MODerately cool
    And MODest too
  • 213
I think here would be a good place to mention that PCS2 has a built in normal calculator so you never have to actually do this math by hand.
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
there are still cases where i perfer my own normals. like when im going for a scatter effect. :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