I am learning Flame and have tested different scenarios in Forge2D that I want to master.
But one thing that I have not found a great solution for, is how to make BodyComponents "fuse" together based on the callbacks and then have just one object instead.
Using the example: https://examples.flame-engine.org/#/Components_Composability
How would I make all the balls "stick" together as one large object, instead just the color change?
Are there any good methods to eg limit the area you will stick?
In such scenario a larger circle should weigh more than smaller ones (more gravtity force on them). Is the radius the only parameter for weight?
Hopefully someone could share their experience on this.
You will have to use a joint for this, it depends a bit on how you want them to stick together which joint you should use. But if you want them to stick together completely, then you can use a WeldJoint
.
Example:
void createWeldJoint(Body first, Body second, Vector2 anchor) {
final weldJointDef = WeldJointDef()..initialize(first, second, anchor);
createJoint(WeldJoint(weldJointDef));
}
https://examples.flame-engine.org/#/flame_forge2d%2Fjoints_WeldJoint