|
28 | 28 | var bodyJointStiffness = 1;
|
29 | 29 |
|
30 | 30 | var composite = new this.Composite();
|
31 |
| - composite.feet = []; |
| 31 | + composite.legs = []; |
32 | 32 |
|
33 | 33 | composite.particles.push(new Particle(origin));
|
34 | 34 | composite.particles.push(new Particle(origin.add(new Vec2(0,-10))));
|
|
65 | 65 | composite.particles.push(rightFoot);
|
66 | 66 | composite.particles.push(leftFoot);
|
67 | 67 |
|
68 |
| - composite.feet.push(rightFoot); |
69 |
| - composite.feet.push(leftFoot); |
| 68 | + composite.legs.push(rightFoot); |
| 69 | + composite.legs.push(leftFoot); |
70 | 70 |
|
71 | 71 | len = composite.particles.length;
|
72 | 72 | composite.constraints.push(new DistanceConstraint(composite.particles[len-4], composite.particles[len-2], legSeg4Stiffness));
|
|
176 | 176 | for (k=0;k<8;++k) {
|
177 | 177 | if (
|
178 | 178 | spider.constraints[j] instanceof DistanceConstraint
|
179 |
| - && spider.constraints[j].a == spider.feet[k] |
| 179 | + && spider.constraints[j].a == spider.legs[k] |
180 | 180 | && spider.constraints[j].b == spiderweb.particles[i])
|
181 | 181 | {
|
182 | 182 | leftFoot = true;
|
|
190 | 190 | }
|
191 | 191 |
|
192 | 192 | for (i in spider.constraints) {
|
193 |
| - if (spider.constraints[i] instanceof DistanceConstraint && spider.constraints[i].a == spider.feet[leg]) { |
| 193 | + if (spider.constraints[i] instanceof DistanceConstraint && spider.constraints[i].a == spider.legs[leg]) { |
194 | 194 | spider.constraints.splice(i, 1);
|
195 | 195 | break;
|
196 | 196 | }
|
197 | 197 | }
|
198 | 198 |
|
199 | 199 | if (paths.length > 0) {
|
200 | 200 | shuffle(paths);
|
201 |
| - spider.constraints.push(new DistanceConstraint(spider.feet[leg], paths[0], 1, 0)); |
| 201 | + spider.constraints.push(new DistanceConstraint(spider.legs[leg], paths[0], 1, 0)); |
202 | 202 | }
|
203 | 203 | }
|
204 | 204 |
|
|
266 | 266 | sim.crawl(((legIndex++)*3)%8);
|
267 | 267 | }
|
268 | 268 |
|
| 269 | + |
269 | 270 | sim.frame(16);
|
270 | 271 | sim.draw();
|
271 | 272 | requestAnimFrame(loop);
|
|
0 commit comments