I want to make a something that lets me click on object, and then I click on a different object, then a constraint will appear between the the clicked squares, or, click an object and then somewhere else and a constraint will appear between where I clicked. I use an emtey array and add bodies into the array like this:
var r = 0;
var rectangles = [];
rectangles.push(new Bodies.rectangle(400, 400, 80, 80));
Composite.add(engine.world, [rectangles[r]]);
r++;
I dont know if this makes a diffence with my plan, so I incuded it anyway. the first main problem i have is that I cant get the mouse to do anything when i click on an element.