i wan to give some intelligence to an enemy, making him turn towards the player a little bit each frame.
i am not sure how to make him turn a little towards him.
i found this, but it does a rotate, not a turn, and i'm not sure how to make it turn just part of the way, like 1% or whatever degree i specify. ATAN is a little beyond me.
Can anyone clue me in?
Function Point_Entity(entity,x#,y#,z#)
xdiff# = EntityX(entity)-x#
ydiff# = EntityY(entity)-y#
zdiff# = EntityZ(entity)-z#
dist#=Sqr#((xdiff#*xdiff#)+(zdiff#*zdiff#))
pitch# = ATan2(ydiff#,dist#)
yaw# = ATan2(xdiff#,-zdiff#)
RotateEntity entity,pitch#,yaw#,0
End Function
; really just want to turn, and a variable amt.
i am not sure how to make him turn a little towards him.
i found this, but it does a rotate, not a turn, and i'm not sure how to make it turn just part of the way, like 1% or whatever degree i specify. ATAN is a little beyond me.
Can anyone clue me in?
Function Point_Entity(entity,x#,y#,z#)
xdiff# = EntityX(entity)-x#
ydiff# = EntityY(entity)-y#
zdiff# = EntityZ(entity)-z#
dist#=Sqr#((xdiff#*xdiff#)+(zdiff#*zdiff#))
pitch# = ATan2(ydiff#,dist#)
yaw# = ATan2(xdiff#,-zdiff#)
RotateEntity entity,pitch#,yaw#,0
End Function
; really just want to turn, and a variable amt.