diff --git a/Assets/Prefabs/RealRemotePlayer.prefab b/Assets/Prefabs/RealRemotePlayer.prefab index 2ecdffd..02750e6 100644 --- a/Assets/Prefabs/RealRemotePlayer.prefab +++ b/Assets/Prefabs/RealRemotePlayer.prefab @@ -1039,8 +1039,11 @@ MonoBehaviour: Name: Image: {fileID: 0} playerModel: {fileID: 1067210703148028} - scale: 0.1 + playerAnim: {fileID: 95748578200216180} + dummieAnims: [] + scale: 1 Animator: {fileID: 95748578200216180} + PlayerModel: {fileID: 1067210703148028} --- !u!136 &136963308744459646 CapsuleCollider: m_ObjectHideFlags: 1 diff --git a/Assets/Scipts/Map.cs b/Assets/Scipts/Map.cs index 91559f0..da7945b 100644 --- a/Assets/Scipts/Map.cs +++ b/Assets/Scipts/Map.cs @@ -33,6 +33,10 @@ public class Map : MonoBehaviour GenerateTiles(); CreateDummys(); + Random.State state = Random.state; + Random.InitState((int)System.DateTime.Now.Ticks); + LocalPlayer.transform.position = new Vector3(Random.Range(minX, maxX), 5, Random.Range(minX, maxX)); + Random.state = state; } //Create dummy players for the world wrapping diff --git a/Assets/Scipts/PlayerControllers/Player.cs b/Assets/Scipts/PlayerControllers/Player.cs index 3bda47f..d584b8e 100644 --- a/Assets/Scipts/PlayerControllers/Player.cs +++ b/Assets/Scipts/PlayerControllers/Player.cs @@ -9,8 +9,8 @@ public class Player : MonoBehaviour public GameObject playerModel; protected Map map; - private Animator playerAnim; - private List dummieAnims = new List(); + public Animator playerAnim; + public List dummieAnims = new List(); public float scale = 0.1f; @@ -61,6 +61,7 @@ public class Player : MonoBehaviour foreach (GameObject dummie in dummies) { dummie.transform.rotation = playerModel.transform.rotation; + dummieAnims[count].SetFloat("WalkSpeed", playerAnim.GetFloat("WalkSpeed")); if (playerAnim.GetBool("PickUp")) diff --git a/Assets/Scipts/PlayerControllers/RemotePlayer.cs b/Assets/Scipts/PlayerControllers/RemotePlayer.cs index 6194b4d..012d531 100644 --- a/Assets/Scipts/PlayerControllers/RemotePlayer.cs +++ b/Assets/Scipts/PlayerControllers/RemotePlayer.cs @@ -5,6 +5,7 @@ using UnityEngine; public class RemotePlayer : Player { public Animator Animator; + public GameObject PlayerModel; private float walkSpeed; private Vector3 lastPosition; @@ -23,9 +24,12 @@ public class RemotePlayer : Player { private void DoAnimation() { - Vector3 dir = lastPosition - transform.position; + Vector3 dir = transform.position - lastPosition; lastPosition = transform.position; 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; } }