I have been following a formula to calculate the buoyant force needed to apply to a dynamic body to be able to simulate water.
Fb = ρgV
- Fb - is the buoyant force
- ρ - density of the liquid
- g - gravity
- V - volume of the object
My box2d body will always be submerged to the sensor so I don't have to detect what portion of the body is in the water, basically the entire body is always in the water and I will always apply the force to the center of the body.
body.applyForceTocenter(0, Fb, true);
If I apply the force on upon collision to the censor then it will just fall cause there is not enough force, and if I type this to the render method then the body will fly cause there is too much force. So how do I implement the force? and how to compute for the drag? so that it won't bounce.