Getting an entity to turn and face another entity?

Blitz3D Forums/Blitz3D Programming/Getting an entity to turn and face another entity?

Craig H. Nisbet(Posted 2004) [#1]
Anymore know how to do this?


cash(Posted 2004) [#2]
Try this

RotateEntity enemy,0,DeltaYaw#(player,enemy),0


Craig H. Nisbet(Posted 2004) [#3]
I'd prefer to use AligntToVector, but I'm not sure how to get the vector.


puki(Posted 2004) [#4]
It is sort of like this, I think:
bx#=EntityX(the other entity))-EntityX(first entity)
bz#=EntityZ(the other entity))-EntityZ(first entity)
bn#=Sqr(bx^2+by^2+bz^2)
bx=bx/bn
bz=bz/bn
AlignToVector first entity,bx,0,bz,0,.1
MoveEntity first entity,0,0,.05