DasAutomat
YaBB Newbies
Offline
Posts: 7
Germany
Re: traer physics attractor problem
Reply #1 - Nov 6th , 2006, 1:22am
//second part of the code //s.setDamping(4f); //s.setStrength(50f); // s.setRestLength(1f); a = new Attraction[8]; a[0] = physics.makeAttraction( foot_l, foot_r, -200, 5 ); a[1] = physics.makeAttraction( arm_l, arm_r, -120000, 5 ); a[2] = physics.makeAttraction( sideTractor, head, 500000, 5 ); a[3] = physics.makeAttraction( sideTractor, body, 500000, 5 ); a[4] = physics.makeAttraction( sideTractor, arm_r, 500000, 5 ); a[5] = physics.makeAttraction( sideTractor, arm_l, 500000, 5 ); a[6] = physics.makeAttraction( sideTractor, foot_r, 500000, 5 ); a[7] = physics.makeAttraction( sideTractor, foot_l, 500000, 5 ); a[2].setMinimumDistance(280000); a[3].setMinimumDistance(280000); a[4].setMinimumDistance(280000); a[5].setMinimumDistance(280000); a[6].setMinimumDistance(280000); a[7].setMinimumDistance(280000); } //make boundary collision handler!!! public void draw() { int[] vals = Unimotion.getSMSArray(); sideTractor.moveTo( mouseX, mouseY, 0 ); if (!mousePressed) physics.advanceTime(0.5f); else { body.moveTo((vals[0]*-1)*-width/2, (vals[1]+1)*height/2, 0); arm_l.moveTo((vals[0]*-1)*-width/2, (vals[1]+1)*height/2, 0); arm_r.moveTo((vals[0]*-1)*-width/2, (vals[1]+1)*height/2, 0); //p.setVelocity((mouseX - pmouseX), (mouseY - pmouseY), 0); } background(255); stroke(0); // line(anchor.position().x(), anchor.position().y(), head.position().x(), head.position().y()); line(body.position().x(), body.position().y(), head.position().x(), head.position().y()); line(body.position().x(), body.position().y(), arm_l.position().x(), arm_l.position().y()); line(body.position().x(), body.position().y(), arm_r.position().x(), arm_r.position().y()); line(body.position().x(), body.position().y(), foot_l.position().x(), foot_l.position().y()); line(body.position().x(), body.position().y(), foot_r.position().x(), foot_r.position().y()); //strings stroke(180); line(arm_r.position().x(), arm_r.position().y(), 0, 0); line(arm_l.position().x(), arm_l.position().y(), width, 0); line(foot_r.position().x(), foot_r.position().y(), 0, 0); line(foot_l.position().x(), foot_l.position().y(), width, 0); noStroke(); ellipse(head.position().x(), head.position().y(), 12*BALLSIZE, 3*BALLSIZE); ellipse(head.position().x(), head.position().y(), 9*BALLSIZE, 9*BALLSIZE); ellipse(body.position().x(), body.position().y(), 12*BALLSIZE, 12*BALLSIZE); ellipse(arm_l.position().x(), arm_l.position().y(), 6*BALLSIZE, 3*BALLSIZE); ellipse(arm_r.position().x(), arm_r.position().y(), 6*BALLSIZE, 3*BALLSIZE); ellipse(foot_l.position().x(), foot_l.position().y(), 8*BALLSIZE, 3*BALLSIZE); ellipse(foot_r.position().x(), foot_r.position().y(), 8*BALLSIZE, 3*BALLSIZE); ellipse(vals[0]*25,vals[1]*25,100,100); ellipse(sideTractor.position().x(),sideTractor.position().y(), 25,25); println(vals[0] + " " + vals[1] + " " + vals[2]); } public static void main(String[] args) { PApplet.main(new String[] { "Puppet_traer" } ); } }