|
@ -5,6 +5,7 @@ using UnityEngine; |
|
|
public class RemotePlayer : Player { |
|
|
public class RemotePlayer : Player { |
|
|
|
|
|
|
|
|
public Animator Animator; |
|
|
public Animator Animator; |
|
|
|
|
|
public GameObject PlayerModel; |
|
|
|
|
|
|
|
|
private float walkSpeed; |
|
|
private float walkSpeed; |
|
|
private Vector3 lastPosition; |
|
|
private Vector3 lastPosition; |
|
@ -23,9 +24,12 @@ public class RemotePlayer : Player { |
|
|
|
|
|
|
|
|
private void DoAnimation() |
|
|
private void DoAnimation() |
|
|
{ |
|
|
{ |
|
|
Vector3 dir = lastPosition - transform.position; |
|
|
|
|
|
|
|
|
Vector3 dir = transform.position - lastPosition; |
|
|
lastPosition = transform.position; |
|
|
lastPosition = transform.position; |
|
|
Animator.SetFloat("WalkSpeed", dir.magnitude); |
|
|
Animator.SetFloat("WalkSpeed", dir.magnitude); |
|
|
transform.forward = dir.normalized; |
|
|
|
|
|
|
|
|
Debug.Log(dir.normalized); |
|
|
|
|
|
|
|
|
|
|
|
PlayerModel.transform.LookAt(PlayerModel.transform.position + dir, Vector3.up); |
|
|
|
|
|
//PlayerModel.transform.forward = dir.normalized;
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |