Following Warforge movement code example my wolf is jerky and I suspect that I need to adjust rate scale of the walk animation to compensate for the speed the wolf moves since distance changes speed of adjustment of the wolf. Any help would be greatly appreciated. I can increase the rate scale and it can help but suspect it needs to be adjusted on the fly.
FollowPlayer(Enemy : creative_prop, Player : player):void=
var PreviousTime : float = GetSimulationElapsedTime()
MoveSpeed := 0.5
loop:
Sleep(0.0)
CurrentTime := GetSimulationElapsedTime()
DeltaTime := CurrentTime - PreviousTime
set PreviousTime = CurrentTime
if (PlayerCharacter := Player.GetFortCharacter, Enemy.IsValid):
PropLocation := Enemy.GetTransform().Translation
PlayerLocation := PlayerCharacter.GetTransform().Translation
if (LookDirection := (PlayerLocation - PropLocation).MakeUnitVector[]):
Yaw := RadiansToDegrees(ArcTan(LookDirection.Y, LookDirection.X)) - 90.0
Pitch := 0.0 #RadiansToDegrees(ArcTan(LookDirection.Z, Sqrt((LookDirection.X * LookDirection.X) + (LookDirection.Y * LookDirection.Y))))
Roll := 0.0
NewRotation := MakeRotationFromYawPitchRollDegrees(Yaw, Pitch, Roll)
# Movement
LerpLocation := Lerp(PropLocation, PlayerLocation, DeltaTime * MoveSpeed)
FinalLocation := vector3{X := LerpLocation.X, Y := LerpLocation.Y, Z := 0.0}
if:
Enemy.TeleportTo[FinalLocation, NewRotation]