   Underwater Physics Simulation?
  Hi all, I would like to ask for direction and guidance for underwater physics simulation? Simulating the drag force of an entity fully submerge. it can be in water bottle, in a tank, or in the ocean. I would like to know where can I find information in simulating this kind of behavior. Thanks. :D   
  You should look at the Archimedes' principle.   ;  As usual, motion is modeled by F=m*a.Underwater, there are three environmental forces that are significant: gravity, drag, and buoyancy. Gravity is the usual Fg = m*g where g = 9.80665 m/s^2 usually on earth. Buoyancy is the force caused by teh pressure difference between the top and bottom of the object. if that sounds hairy, dont worry, it works out to Fb = rho*g*V where rho is density of the fluid (1000 kg/m^3 for fresh water, 1025? for seawater, or 1.2 for air), g is gravitational field strength (as above), and V is displacement volume of the object. For more info, google buoyancy and archimedes principal, as apatricia mentioned.Drag is a bit fun, it is the integral of dynamic pressure over the surface (yuck). This one doesn't work out nice, so we use approximations: A particularly nice one is Fd = Cd*rho*A*v*abs(v) where Cd is a unitless area modifaction coefficient based on shape, A is frontal area, rho is density, as above, v is velocity relative to the fluid, and abs is vector magnitude. This calculation unfortunately requires a square root when you work it into vector form, so a cheaper approximation might be desired. The cheaper model is the linearized Fd = Cd*rho*A*v, which doesn't require the costly square root, and is amenable to analytic solution (really useful for integration, next paragraph), but isn't as realistic.In underwater physics, the drag force is generally big, so integrator stability is super important. If you arent careful, your sim will diverge (blow up). There are three integrators that I think would be good for this: Runge-Kutta 4th order (google rk4), verlet, and analytic exact. The rk4 is a nice general purpose integrator, very stable, very accurate, but requires access to the force calculation internally. Verlet integration just requires you to give it the force at the beginning of time step, and it goes from there (not as good as rk4). The best of course is the exact analytic solution, which is possible with the linear drag model. This gives best results, but involves differential calculus to solve the motion, it also requires access to the internals of your force model. You wont get a full analytic solution, because player input and stuff is not a nice function, however you can encapsulate that part pretty well.I don't know of any good references for this stuff specifically, but you can try a website called euclideanspace which has alot of good stuff of this general sort.I hope this helps.   