diff --git a/.vs/Hexapod/v15/Server/sqlite3/storage.ide b/.vs/Hexapod/v15/Server/sqlite3/storage.ide index b12e73c..4781257 100644 Binary files a/.vs/Hexapod/v15/Server/sqlite3/storage.ide and b/.vs/Hexapod/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/Hexapod/v15/Server/sqlite3/storage.ide-shm b/.vs/Hexapod/v15/Server/sqlite3/storage.ide-shm index 84b8580..8c02b82 100644 Binary files a/.vs/Hexapod/v15/Server/sqlite3/storage.ide-shm and b/.vs/Hexapod/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Hexapod/v15/Server/sqlite3/storage.ide-wal b/.vs/Hexapod/v15/Server/sqlite3/storage.ide-wal index 9cd8258..952fa77 100644 Binary files a/.vs/Hexapod/v15/Server/sqlite3/storage.ide-wal and b/.vs/Hexapod/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Assets/Main.unity b/Assets/Main.unity index bff9154..fdf786d 100644 --- a/Assets/Main.unity +++ b/Assets/Main.unity @@ -48756,7 +48756,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 311513960} - m_Enabled: 0 + m_Enabled: 1 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 62866dc69f17c5f40a7ec527e34e82f1, type: 3} m_Name: @@ -48769,7 +48769,7 @@ MonoBehaviour: - {fileID: 1772413224} - {fileID: 210611261} st: 5 - speed2: 5 + speed2: 30 rotation: 0 walkspeed: 1.5 --- !u!114 &311513964 @@ -48778,7 +48778,7 @@ MonoBehaviour: m_PrefabParentObject: {fileID: 0} m_PrefabInternal: {fileID: 0} m_GameObject: {fileID: 311513960} - m_Enabled: 1 + m_Enabled: 0 m_EditorHideFlags: 0 m_Script: {fileID: 11500000, guid: 91e6f3895f276d94da1803128e6290e0, type: 3} m_Name: @@ -48791,8 +48791,8 @@ MonoBehaviour: - {fileID: 1772413224} - {fileID: 210611261} st: 5 - speed2: 5 - rotation: 1 + speed2: 20 + rotation: 5 --- !u!1 &311874317 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Walk.cs b/Assets/Walk.cs index 44d3dc8..8b03700 100644 --- a/Assets/Walk.cs +++ b/Assets/Walk.cs @@ -13,6 +13,7 @@ public class Walk : MonoBehaviour for (int index = 0; index < legs.Count; ++index) { legsInitial.Add(legs[index].GetComponent().point); + step2.Add( new Vector3() ); } } @@ -61,6 +62,8 @@ public class Walk : MonoBehaviour public float walkspeed = 1; + private List step2 = new List(); + // Update is called once per frame void FixedUpdate() { @@ -85,17 +88,32 @@ public class Walk : MonoBehaviour t2.x *= walkspeed; // rotate x,y around rotation. - legs[index].GetComponent().point += Quaternion.Euler(0, rotation, 0) * t2; + step2[index] = (Quaternion.Euler(0, rotation, 0) * t2) / speed2; } else { - legs[index].GetComponent().point = legsInitial[index] + s[t].pos; + Vector3 t2 = s[t].pos; + t2.x *= walkspeed; + + // rotate x,y around rotation. + step2[index] = (Quaternion.Euler(0, rotation, 0) * t2) / speed2; } } speed = speed2; } else + { speed--; + makestep(); + } + } + + void makestep() + { + for (int index = 0; index < legs.Count; ++index) + { + legs[index].GetComponent().point += step2[index]; + } } } diff --git a/Assets/Walk2.cs b/Assets/Walk2.cs index d275907..548a1ec 100644 --- a/Assets/Walk2.cs +++ b/Assets/Walk2.cs @@ -13,6 +13,8 @@ public class Walk2 : MonoBehaviour for (int index = 0; index < legs.Count; ++index) { legsInitial.Add(legs[index].GetComponent().point); + step2.Add(0); + step3.Add(0); } } @@ -62,13 +64,15 @@ public class Walk2 : MonoBehaviour int size = 8; //public float walkspeed = 1; + private List step2 = new List(); + private List step3 = new List(); // Update is called once per frame void FixedUpdate() { if (speed <= 0) { - if (st >= size-1) + if (st >= size - 1) st = 0; else st++; @@ -83,21 +87,34 @@ public class Walk2 : MonoBehaviour if (s[t].inAir == false) { - Vector3 n = legs[index].GetComponent().getWorldPos(); - n = Quaternion.Euler(0, rotation * s[t].rotation, 0) * n; - n.y += s[t].height; - // rotate x,y around rotation. - legs[index].GetComponent().setWorldPos(n); + step2[index] = (rotation * s[t].rotation) / speed2; + step3[index] = s[t].height / speed2; } else { - legs[index].GetComponent().point = legsInitial[index] + new Vector3(0, s[t].height, 0); + step2[index] = (rotation * s[t].rotation) / speed2; + step3[index] = s[t].height / speed2; } } speed = speed2; } else + { speed--; + makestep(); + } + } + + void makestep() + { + for (int index = 0; index < legs.Count; ++index) + { + Vector3 n = legs[index].GetComponent().getWorldPos(); + n = Quaternion.Euler(0, step2[index], 0) * n; + n.y += step3[index]; + // rotate x,y around rotation. + legs[index].GetComponent().setWorldPos(n); + } } }