|
|
@ -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;
|
|
|
|