How swimming works is an object pushes water
molecules aside and takes up that new available space. This is
why gravity in water seems smaller because water is actually
pushing you up.
Archimedes' principle states that an object
is buoyed up with a force equal to the weight of the water
pushed aside by the object.
Game Example: Mario Sunshine is a
good example of buoyancy because it is obvious that he bobs up
and down
(Mario Sunshine, taken by me)
while swimming, as shown to the right. His drowning meter is not
shown so he is still considered above the water.
The Buoyancy equation is F=d*h*A*g
Where F is the force of Buoyancy
d is the density of the fluid
h is the height of the immersed part of the object
A is the area of the object
g is gravity
-Time limits
Both Mario Sunshine and Windwaker have time
limits on a seemingly endless ocean-which makes player boredom
at a minimum if your trying to swim wanderlessly forever.
Mario and Windwaker have invisible
walls that stop you when the ocean map goes no further. But
Windwaker takes it a step further. In Windwaker there is ocean
everywhere and so swimming possibilities should seem endless,
but in reality the main character can only swim for a certain
amount of time before he drowns. He has a drowning circle/bar on
the right bottom of the screen.
This keeps the player from swimming forever
or getting stuck in endless ocean for too long-because you'll
die.
(picture of Windwaker, by me)
-Drag
Drag is important for swimming, that's why
professional swimmers, to cut down drag, shave their hair and
wear swimming suits! In games it really just makes water feel
more like water, and the character move slower.
Drag opposes the motion force so it is equal
in magnitude and opposite in direction to the force of motion.
(If the object is moving at a constant speed, not speeding up).
The drag equation is: D=0.5*C*d*A*v^2
Where D is drag
C is the drag coefficient (different in different mediums)
d is the density of the fluid (water is 1 kg/m^3)
A is the Cross sectional area (area of object)
v is the velocity of the object in meters/sec
In video games drag is often implemented by
making the character's speed lower when they hit the water.
Gravity
Gravity is pretty simple and common, should
you add it to a swimming portion? It is really up to you. New
Super Mario Bros has obvious gravity where you sink pretty fast
under water.
Others don't have gravity under water at
all-like Rayman or Donkey Kong Tropical Freeze. Either way is
really just a preference for game makers. (But you should know
that Donkey Kong is famous for its fun underwater levels!)
If you do want to implement it here's what
you'll need to consider:
Gravity vs.
Buoyancy -how much gravity will you actually feel? Think of when
you're swimming in real life, do you sink fairly fast or slow?
Does it depend on your movement or how much air you have in your
lungs?
Game Examples: In Windwaker's case,
Link gets his lungs full of water and starts to sink. In Mario
Sunshine, buoyancy seems to be dominant, taking longer to swim
to the bottom then to swim to the top.
Remember that the water is pushing up on the
object, that is why gravity is going to be smaller in water.
Nov
26
Sum up of Swimming
What you should take away from all this is
that there are 4 different forces acting on your swimming
object. So the object is being pulled in 4 different
directions to simulate swimming. Up=buoyancy, Down=gravity,
and -Drag=Motion. (Drag opposing Motion)