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())
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())