I am working on hydrodynamic modeling of a ship in an animated sea, and contemplating using Bullet for this.
My first inclination is the following design:
The ship will have a single RigidBody
Buoyancy will be modeled by having an invisible, simplified hull mesh whose triangles will each be sampled to find the depth of their centroid below the local water surface. Each will have a normal water pressure vector calculated, and this will be a force through its location relative to the ship’s Rigidbody, acting upon it
The mass of the ship, and its gravity effect will be divided into 4 point masses: two on the centerline about 1/4 and 3/4 along the length of the ship, and 2 athwart its center of gravity about 1/4th the beam outboard. Each of these masses will be 1/4 the mass of the total vessel. The intent of this model is that these will mimic the effect of rotational inertia: the ship is not a point mass.
My questions are these:
Why does Bullet treat torque as separate from force? Isn’t torque simply an effect of force being applied to a lever that is constrained by a fixed rotational axis?
What mass should I assign my single Rigidbody? Zero?
Am I not thinking properly of how to use Bullet components to model this ship? Is it a system of 4 RigidBodies with masses of 1/4 the ship’s mass and not a single Rigidbody?
Possibly. I confess I find these very difficult to understand as offered.
For instance, I don’t see why CompoundShape is derived from CollisionShape is derived from Object, but PhysicsRigidBody (the one that has the nice means of applying forces at different points and which has mass, although it appears to be treated as a point mass) is derived from PhysicsCollisionObject which is derived from Object. Therefore, I do not see how I am going to get my ship to have rotational momentum in pitch and roll, which I was aspring to do by having it be a rigid assembly of point masses.
I have, however, written a bunch of code to calculate the forces.
I am going to first try treating the hull as a single RigidBody. I will apply gravitational forces through the offsets for those quarter-weights and try to separately calculate continued motion attributable to rotational inertia. I am not sure how it fits with the JME3/Bullet tools available.
I might be able to share my findings if/when I complete this. The idea of using water pressure on the faces of a hull mesh is a good alternative, I hope, to volumetric methods of calculating buoyancy.