-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRunner.pde
40 lines (36 loc) · 873 Bytes
/
Runner.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class Runner extends Walker {
Runner(float height) {
super(height);
params = new float[] {
0.08, // arm1
0.68,
0.16,
0.15, // arm2
0.5,
-HALF_PI * 0.5,
0.55, // leg1
0.58,
-HALF_PI * 0.05,
0.5 - 0.288, // leg2
0.34,
HALF_PI * 0.35
};
}
float calcYOffset(float phase) {
int ip = (int)(phase * 2);
float dp = phase * 2 - ip - 0.5;
float offset = height * (1.11 - (dp * dp) * 0.18);
float lowest = max(legs[0][1].y, legs[1][1].y);
if(offset > lowest) {
return offset;
}
return lowest;
}
void setBasicPositions() {
float angle;
angle = 0.2;
head.set(sin(angle) * upperBodyLength, 0);
shoulder.set(sin(angle) * (upperBodyLength - neckLength), cos(angle) * neckLength);
waist.set(0, cos(angle) * upperBodyLength);
}
}