v6 rotational walking :D

This commit is contained in:
2018-11-14 22:22:38 +01:00
parent b505fe4618
commit 131529576c
9 changed files with 167 additions and 18 deletions
+11 -1
View File
@@ -24,7 +24,7 @@ public class Leg : MonoBehaviour {
public double translateZ = 0;
public GameObject pointShouldBe;
public Vector3 pos = new Vector3(0, 0, 0);
//public Vector3 pos = new Vector3(0, 0, 0);
public int startServo = -1;
@@ -99,6 +99,16 @@ public class Leg : MonoBehaviour {
pointShouldBe.transform.localPosition = foot.pos;
}
public Vector3 getWorldPos()
{
return point + new Vector3((float)translateX, (float)translateY, (float)translateZ);
}
public void setWorldPos(Vector3 pos)
{
this.point = pos - new Vector3((float)translateX, (float)translateY, (float)translateZ);
}
public static float Remap(float value, float from1, float to1, float from2, float to2)
{
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;