[SOLVED] fisica joints not working
in
Contributed Library Questions
•
1 year ago
so i am trying to get a simple distance joint sketch running and for some reason i can't get joints to show up or work. I've tried in processing 2.0a4 and 1.5.1. here is the code i'm trying to run:
- import fisica.*;
- FWorld world;
- FBlob myBlob;
- float frequency = 5;
- float damping = 1;
- FBox box;
- FBox box2;
- FBlob blob;
- FDistanceJoint joint;
- FDistanceJoint joint2;
- void setup() {
- size(960, 600);
- Fisica.init(this);
- world = new FWorld();
- world.setEdges(255);
- world.setGravity(0, 100);
- world.setGrabbable(true);
- box = new FBox(100, 100);
- box.setStatic(true);
- box.setPosition(width/3, height/3);
- world.add(box);
- box2 = new FBox(100, 100);
- box2.setStatic(true);
- box2.setPosition(width/1.5, height/3);
- world.add(box2);
- blob = new FBlob();
- blob.setAsCircle(width/2, height/2, 60);
- world.add(blob);
- joint = new FDistanceJoint(box, blob);
- joint.setDrawable(true);
- //joint.setFrequency(frequency);
- //joint.setDamping(damping);
- joint.setStrokeWeight(2);
- joint.setStroke(0);
- world.add(joint);
- joint2 = new FDistanceJoint(blob, box2);
- joint2.setDrawable(true);
- //joint2.setFrequency(frequency);
- //joint2.setDamping(damping);
- joint2.setStrokeWeight(2);
- joint2.setStroke(0);
- world.add(joint2);
- }
- void draw() {
- background(255);
- world.step();
- world.draw();
- }
Should be simple enough, gravity and everything else seems to work with fisica but not joints, i used the examples provided with fisica as reference but i don't know if it's me and i'm missing something or if there is something else going on. any help would be greatly appreciated.
1