Tformvector help
Blitz3D Forums/Blitz3D Programming/Tformvector help
| ||
I need to transform a vector in worldspace to the coordinate system defined by another vector. The standard tformvector function only works with entities. |
| ||
Well, what coordinate system is your vector in? |
| ||
it is in worldspace |
| ||
I mean what coord system is your 'destination' vector in? |
| ||
the dest coordinate system is defined by a vector instead of a destination entity like in tformvector function. Sorry maybe I'm not so clear :) |
| ||
Well, your dest vector must be in one coord system or another. :) |
| ||
Use a helper pivot and align it to the vector and then tformvector;assume d.vector3 is destination ;assume w.vector3 is the world vector ;assume n.vector3 is the new vector global HelperPivot = createpivot() . . . aligntovector HelperPivot, d\x, d\y, d\z, 3 tformvector w\x, w\y, w\z , 0 , HelperPivot n\x = tformedx() n\y = tformedy() n\z = tformedz() You could also use Dot product for this. Stevie |
| ||
I'll explain my problem in detail :) I have my particle system where the emission dir is defined by the Z vector(-1) and use random XY (rnd(X,-X),rnd(Y,-Y)) to modify the emission cone. Suppose I need the emission cone direction aligned to a vector that is pointing to the right; this way XY should become ZY. The fastest way to transform XY to ZY ? |