From 82937f97b81b0d78c54df72fc91f91f0d0a865d0 Mon Sep 17 00:00:00 2001 From: Joshua Reason Date: Thu, 31 Jan 2019 16:38:08 +1100 Subject: [PATCH] updated local pplayer animation calc --- Assets/Scipts/PlayerControllers/RemotePlayer.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Assets/Scipts/PlayerControllers/RemotePlayer.cs b/Assets/Scipts/PlayerControllers/RemotePlayer.cs index 012d531..d72c69c 100644 --- a/Assets/Scipts/PlayerControllers/RemotePlayer.cs +++ b/Assets/Scipts/PlayerControllers/RemotePlayer.cs @@ -10,6 +10,8 @@ public class RemotePlayer : Player { private float walkSpeed; private Vector3 lastPosition; + private float LastSpeed = 0; + public void Start() { lastPosition = transform.position; @@ -26,8 +28,13 @@ public class RemotePlayer : Player { { Vector3 dir = transform.position - lastPosition; lastPosition = transform.position; - Animator.SetFloat("WalkSpeed", dir.magnitude); - Debug.Log(dir.normalized); + + float DesiredSpeed = dir.magnitude * 10; + float setSpeed = Mathf.Lerp(LastSpeed, DesiredSpeed, 0.1f); + + Animator.SetFloat("WalkSpeed", setSpeed); + Debug.Log(setSpeed); + LastSpeed = setSpeed; PlayerModel.transform.LookAt(PlayerModel.transform.position + dir, Vector3.up); //PlayerModel.transform.forward = dir.normalized;