summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/SmarterWalkAnimation.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/SmarterWalkAnimation.java b/src/SmarterWalkAnimation.java
index 9b4d7f0..bf4e72e 100644
--- a/src/SmarterWalkAnimation.java
+++ b/src/SmarterWalkAnimation.java
@@ -25,7 +25,8 @@ public class SmarterWalkAnimation implements WalkAnimation {
private final double legLength;
private final double cycleLength;
- private final double MAX_LEG_ANGLE_DEG = 40.0;
+ private static final double MAX_LEG_ANGLE_DEG = 40.0;
+ private static final double MAX_ARM_ANGLE_DEG = 30.0;
/**
* Maximum percentage of the legs length to lift the feet.
*/
@@ -38,6 +39,8 @@ public class SmarterWalkAnimation implements WalkAnimation {
private double knee_angle_left;
private double knee_angle_right;
private double bodyOffset;
+ private double arm_angle_left;
+ private double arm_angle_right;
SmarterWalkAnimation(float legTopLength, float legBottomLength) {
this.legTopLength = legTopLength;
@@ -98,6 +101,9 @@ public class SmarterWalkAnimation implements WalkAnimation {
leg_angle_left += cosineRule(legTopLength, dist_leg_l, legBottomLength);
leg_angle_right += cosineRule(legTopLength, dist_leg_r, legBottomLength);
+ arm_angle_left = MAX_ARM_ANGLE_DEG * cos(pos / 2 * PI);
+ arm_angle_right = MAX_ARM_ANGLE_DEG * sin(pos / 2 * PI);
+
bodyOffset = legLength * body.y;
}
@@ -123,12 +129,12 @@ public class SmarterWalkAnimation implements WalkAnimation {
@Override
public double getArmAngleLeft() {
- return 0;
+ return arm_angle_left;
}
@Override
public double getArmAngleRight() {
- return 0;
+ return arm_angle_right;
}
@Override