Im creating a 3D Verlet Ragdoll and what Im trying to do is point an entity at another entity (or point it at xyz, doesnt matter), I have tried using pointentity command and also the following code found in the archives :-
;===========================
;Point Entity at x,y,z
;===========================
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
;===========================
But when both the entity and target are moving, the entity tracks the target and points at it, but it sometimes spins (thats the best way to describe it), this happens when using both the above methods. I've tried using aligntovector but no success.
Has anybody else come across this problem and managed to find a solution.
;===========================
;Point Entity at x,y,z
;===========================
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
;===========================
But when both the entity and target are moving, the entity tracks the target and points at it, but it sometimes spins (thats the best way to describe it), this happens when using both the above methods. I've tried using aligntovector but no success.
Has anybody else come across this problem and managed to find a solution.