In Box2D, how would I go about making a body that's being lifted by multiple "balloons"? These balloons would have to be able to be destroyed (for example, by a bow and arrow).
1 Answer
I would model the balloon as a circle shape physics-body and use ApplyForce
to apply an upward force to the body. If the applied force is negative(gravity * mass)
, then the balloon should be standing still in the air. Applying a stronger force will cause the balloon to move upwards.
You can then connect another body to the balloon using joints (eg. a distance-joint). If the applied force on the balloon is strong enough, it should also lift the attached body. You might have to experiment with the force to apply and also with the mass of the bodies you want to attach to the balloons (the mass should be rather low to keep things realistic).
Destroying the balloon would simply mean to destroy the balloons physics body and maybe also the joint.