frankb
YaBB Newbies
Offline
Posts: 44
physics
Aug 31st , 2006, 12:54am
I'm trying to learn how to use the trear physics plug in. Just to get myself going I droped the source code from one of the examples in the editor and tried to run the code. import traer.physics.*; ParticleSystem physics; Particle p; Particle anchor; Spring s; void setup() { size( 400, 400 ); smooth(); fill( 0 ); framerate( 24 ); ellipseMode( CENTER ); physics = new ParticleSystem( 5.0, 0.05 ); p = physics.makeParticle( 1.0, width/2, height/2, 0 ); anchor = physics.makeParticle( 1.0, width/2, height/2, 0 ); anchor.makeFixed(); s = physics.makeSpring( p, anchor, 1.0, 0.1, 100 ); } void draw() { if ( !mousePressed ) physics.advanceTime( 1.0 ); else { p.moveTo( mouseX, mouseY, 0 ); p.setVelocity( (mouseX - pmouseX), (mouseY - pmouseY), 0 ); // this is so you can throw it... } background( 255 ); line( p.position().x(), p.position().y(), anchor.position().x(), anchor.position().y() ); ellipse( anchor.position().x(), anchor.position().y(), 5, 5 ); ellipse( p.position().x(), p.position().y(), 20, 20 ); } This is supposed to set up two particles and a spring. However I get the following message. Semantic Error: No accessible method with signature "position()" was found in type "Particle". which is supposidly in resonce to this line p = physics.makeParticle( 1.0, width/2, height/2, 0 ); however I can't figure out what is wrong. I was wondering if some one with more experiance may be abel to explain this.