VerletParticle2D p = new VerletParticle2D( Vec2D.randomVector().scale( 5 ).addSelf( width / 2, height / 2) );
physics.addParticle( p );
physics.addBehavior( new AttractionBehavior( p, 20, attractionStrength, attractionJitter ) );
I want to be able to change the strength and jitter values of the attraction behaviour at will once the all the particles have been created but I'm not sure how to access the particles behaviour and apply the new values, any help will be much appreciated.
If you add attractionBehaviors like this it's hard to find the one you want once you need it again. So I usually extend the VerletParticle2D class to make it's attractionBehavior part of the class. That way you can always find the attractionBehavior associated with that particle later. Also see the code example I mailed you.
Leave a comment on amnon.owed's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic