# Swimming in BGE

So I’ve added one feature that some survival games don’t have…swimming. So I’ve set the the land into water and vise versa transitions and animations. The real problem is this…floating. The player just sinks under water and collides with the land. I also want to add diving so don’t recommend any static collisions.

1 Like

Apply force up if below the water, and down if your above it. This will cause the player to float on the surface.

i would make a model out of the lake, then that object is the lake. then when player gets into the lake/object that object giving z upforce (9.8 is default gravity) so around 9 or so would be good.

1 Like

How do I do this?

with keyboard and mouse

my way, just make a mesh as big and deep as the lake, collision->and->motion then zet force to 9 or so and hit the L behind it if it isn’t on yet.

I’m not getting where you’re going at. Also, I’m not trying to make this complicated.

you got a pool/lake/ocean/river/ or whatever, to swim in right?
so fill that river with a cube(mesh) scale/build the cube to fill the swimming area.

so far so good?

now add collision -> and - > motion, onto the cube/mesh

still got it?

put the motion brick at a force of 9 or so.

now if something hit the cube/mesh it will push it slowly in the direction that you have set the force at.
so jump in and it will push you slowly upwards, to me that is called floating.

then you need to apply the proper bricks to handle your characters motion(swimming)

Um, should I add a constraint?

@Cotaks, probably you best bet is to just give him a working, simple to read .blend file.

Also, do you want a floating animation, or just be there, no up or down motion? You could make the water no collision, then add an invisible plane that is static below it.

here is a way to get swimming and diving.

the trick here is to have the player standing on a plane that you move up or down when in the water.

example blend:
http://15b.dk/blendfiles/swimming.blend