Grass in toxiclibs - Verlet Physics?
in
Contributed Library Questions
•
2 years ago
I'd like to make some grass that responds to wind and gravity:
I've been struggling with this for over week now (yes, I'm an artist - ie. not a very good programmer). Today my friend suggested I look into Verlet Physics, and to my delight I found that it was sitting right there under my nose in toxiclibs. The bundled examples are quite helpful, especially the one called 'ThreadDemo'.
I managed to get some gravity and wind working in ThreadDemo adding some physics behaviours:
The problems I'm facing are:
I've been struggling with this for over week now (yes, I'm an artist - ie. not a very good programmer). Today my friend suggested I look into Verlet Physics, and to my delight I found that it was sitting right there under my nose in toxiclibs. The bundled examples are quite helpful, especially the one called 'ThreadDemo'.
I managed to get some gravity and wind working in ThreadDemo adding some physics behaviours:
- physics.addBehavior(new GravityBehavior(new Vec2D(0, 0.5)));
- physics.addBehavior(new ConstantForceBehavior(new Vec2D(0.2, 0)));
The problems I'm facing are:
- preserving the length between the particles (I don't want the blades of grass to look like elastic bands).
- giving the particle string some rotational stiffness (so that it can counteract the net force of the wind and gravity).
1