Bernard Laptop 5 years ago
parent
commit
823a964f21
1 changed files with 9 additions and 2 deletions
  1. +9
    -2
      Assets/Scipts/PlayerControllers/RemotePlayer.cs

+ 9
- 2
Assets/Scipts/PlayerControllers/RemotePlayer.cs View File

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

Loading…
Cancel
Save