Smart turning

Blitz3D Forums/Blitz3D Beginners Area/Smart turning

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Try this...

Function Point_Entity(entity,Target)
xt#=entityx(Target)
yt#=entityy(Target)
zt#=entityz(Target)
xdiff# = EntityX(entity)-xt#
ydiff# = EntityY(entity)-yt#
zdiff# = EntityZ(entity)-zt#
dist#=Sqr#((xdiff#*xdiff#)+(zdiff#*zdiff#))
pitch# = ATan2(ydiff#,dist#)
yaw# = ATan2(xdiff#,-zdiff#)
RotateEntity entity,pitch#,yaw#,0
End Function

..its quite useful so by disabling let say pitch# /RotateEntity entity,0,yaw#,0/ you will get only Y axis rotation towards Target or do combination you want..