Direction to vector?

Blitz3D Forums/Blitz3D Programming/Direction to vector?

njesper(Posted 2003) [#1]
Hi there,
Please help me with the following question:

I have the "roll, pitch and yaw" of objectA, and I want objectB to be translated in the direction, without changing orientation of objectB (translateEntity objectB,?,?,?).

Is there a simple "direction" to vector (i guess) command?

Best regards,
Jesper Colding - Jørgensen


Tom(Posted 2003) [#2]
Assuming Z+ is forward for objectA, and you want to move objectB along the direction vector objectA is pointing:

TFormVector(0,0,1,objectA,0)
vx#=TFormedX#() * distancetomove#
vy#=TFormedY#() * distancetomove#
vz#=TFormedZ#() * distancetomove#

PositionEntity objectB,vx,vy,vz,True

Multiply vx,vy,vz by the distance you want to move it.

Someone correct me if I'm wrong :)
Tom

p.s what's the freakin tag for CODE?


njesper(Posted 2003) [#3]
Hi Tom,

Thanks maan, Got it to work!
I'll continue with my platformgame then. :-)

Best regards,
Jesper