easy z axis?

Blitz3D Forums/Blitz3D Programming/easy z axis?

Cousin Gilgamesh(Posted 2005) [#1]
I'm writiing a code segment where I need the direction that the mesh's Z axis is pointed. is there an easier way to do it than this?

PositionX = entityX(mesh)
PositionY = entityY(mesh)
PositionZ = entityZ(mesh)

moveentity mesh, 0, 0, 1

;components of z axis vector
VectorX = entityX(mesh) - PositionX
VectorY = entityY(mesh) - PositionY
VectorZ = entityZ(mesh) - PositionZ

positionentity mesh, PositionX, PositionY, PositionZ, true

-this would work(or at least something like it), but it buugs me. Is there a way to do it without moving the mesh?


Ezbe(Posted 2005) [#2]
TForm-commands are good for this

TFormPoint 0, 0, 1, mesh, 0
VectorX# = TFormedX()
VectorY#...

If you want to know the heading of an entity, try something like

TFormVector 0, 0, 1, mesh, 0
MeshYaw = VectorYaw(TFormedX(), TFormedY(), TFormedZ())
MeshPitch = VectorPitch(TFormedX(), TFormedY(), TFormedZ())


Cousin Gilgamesh(Posted 2005) [#3]
I've never used those commands before, but they look promising. I will investigate these TForm commands. Thanks a bundle.


Cousin Gilgamesh(Posted 2005) [#4]
I've never used those commands before, but they look promising. I will investigate these TForm commands. Thanks a bundle.


Cousin Gilgamesh(Posted 2005) [#5]
wth? ok never mind the second post.