v7 slow talking :D

This commit is contained in:
mangavalk committed 2018-11-15 14:11:50 +01:00
1 parent 8630ef0753
commit 04062fc3b8
6 files changed
+49 -14

No files matched your search

Binary file not shown.
Binary file not shown.
+20 -2
View File
@@ -13,6 +13,7 @@ public class Walk : MonoBehaviour
for (int index = 0; index < legs.Count; ++index) for (int index = 0; index < legs.Count; ++index)
{ {
legsInitial.Add(legs[index].GetComponent<Leg>().point); legsInitial.Add(legs[index].GetComponent<Leg>().point);
step2.Add( new Vector3() );
} }
} }
@@ -61,6 +62,8 @@ public class Walk : MonoBehaviour
public float walkspeed = 1; public float walkspeed = 1;
private List<Vector3> step2 = new List<Vector3>();
// Update is called once per frame // Update is called once per frame
void FixedUpdate() void FixedUpdate()
{ {
@@ -85,17 +88,32 @@ public class Walk : MonoBehaviour
t2.x *= walkspeed; t2.x *= walkspeed;
// rotate x,y around rotation. // rotate x,y around rotation.
legs[index].GetComponent<Leg>().point += Quaternion.Euler(0, rotation, 0) * t2; step2[index] = (Quaternion.Euler(0, rotation, 0) * t2) / speed2;
} }
else else
{ {
legs[index].GetComponent<Leg>().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; speed = speed2;
} }
else else
{
speed--; speed--;
makestep();
}
}
void makestep()
{
for (int index = 0; index < legs.Count; ++index)
{
legs[index].GetComponent<Leg>().point += step2[index];
}
} }
} }
+24 -7
View File
@@ -13,6 +13,8 @@ public class Walk2 : MonoBehaviour
for (int index = 0; index < legs.Count; ++index) for (int index = 0; index < legs.Count; ++index)
{ {
legsInitial.Add(legs[index].GetComponent<Leg>().point); legsInitial.Add(legs[index].GetComponent<Leg>().point);
step2.Add(0);
step3.Add(0);
} }
} }
@@ -62,13 +64,15 @@ public class Walk2 : MonoBehaviour
int size = 8; int size = 8;
//public float walkspeed = 1; //public float walkspeed = 1;
private List<float> step2 = new List<float>();
private List<float> step3 = new List<float>();
// Update is called once per frame // Update is called once per frame
void FixedUpdate() void FixedUpdate()
{ {
if (speed <= 0) if (speed <= 0)
{ {
if (st >= size-1) if (st >= size - 1)
st = 0; st = 0;
else else
st++; st++;
@@ -83,21 +87,34 @@ public class Walk2 : MonoBehaviour
if (s[t].inAir == false) if (s[t].inAir == false)
{ {
Vector3 n = legs[index].GetComponent<Leg>().getWorldPos(); step2[index] = (rotation * s[t].rotation) / speed2;
n = Quaternion.Euler(0, rotation * s[t].rotation, 0) * n; step3[index] = s[t].height / speed2;
n.y += s[t].height;
// rotate x,y around rotation.
legs[index].GetComponent<Leg>().setWorldPos(n);
} }
else else
{ {
legs[index].GetComponent<Leg>().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; speed = speed2;
} }
else else
{
speed--; speed--;
makestep();
}
}
void makestep()
{
for (int index = 0; index < legs.Count; ++index)
{
Vector3 n = legs[index].GetComponent<Leg>().getWorldPos();
n = Quaternion.Euler(0, step2[index], 0) * n;
n.y += step3[index];
// rotate x,y around rotation.
legs[index].GetComponent<Leg>().setWorldPos(n);
}
} }
} }