public void Movement() { // all meausurements are in inches float liftHeight = 1.5f; float walkLength = 3.0f; int[] frames = new int[4] { 9, 3, 6, 0 }; int frameCount = 12; float divFactor = 9; // initial shadow.legs[Shadow.FL].Position = new Vector3D(shadow.legs[Shadow.FL].Position.x, shadow.legs[Shadow.FL].Position.y, 1.5f); shadow.legs[Shadow.FR].Position = new Vector3D(shadow.legs[Shadow.FR].Position.x, shadow.legs[Shadow.FR].Position.y, -0.5f); shadow.legs[Shadow.RL].Position = new Vector3D(shadow.legs[Shadow.RL].Position.x, shadow.legs[Shadow.RL].Position.y, -0.5f); shadow.legs[Shadow.RR].Position = new Vector3D(shadow.legs[Shadow.RR].Position.x, shadow.legs[Shadow.RR].Position.y, -1.5f); shadow.RefreshHardware(); System.Threading.Thread.Sleep((int)(shadow.LastMovementTime)); Dump(); for (int frame = 0; frame < frameCount; frame++) { // 0 = FL, 1 = FR, 2 = RL, 3 = RR for (int leg = 0; leg < 4; leg++) { if (frame == frames[leg]) { shadow.legs[leg].Position += new Vector3D(0, liftHeight, 0); } else if (frame == frames[leg] + 1) { var pos = shadow.legs[leg].Position; pos.z = walkLength / 2.0f; shadow.legs[leg].Position = pos; } else if (frame == frames[leg] + 2) { shadow.legs[leg].Position += new Vector3D(0, -liftHeight, 0); } else { var amount = walkLength / divFactor; shadow.legs[leg].Position -= new Vector3D(0, 0, amount); } } Logger.Instance.Log("Frame {0}", frame); Dump(); shadow.RefreshHardware(); System.Threading.Thread.Sleep((int)(shadow.LastMovementTime - 10)); } }