Swimming...

Blitz3D Forums/Blitz3D Beginners Area/Swimming...

stayne(Posted 2007) [#1]
I need my player to be able to swim. Swimming underwater is no problem but as soon as the player mesh gets to the surface, gravity shoves it back down repeatedly and I need the player to be able to swim along the surface. Any ideas? I'm currently setting swimming to true if the player mesh is below the water's surface.


stayne(Posted 2007) [#2]
Can't test this at the moment but I'm wondering...

Place a pivot in front of the player near center mass. Reduce gravity to zero if the pivot is below the water plane, but ONLY while the head pivot is ABOVE the water plane. That way the player can still dive under if they rotate forward.

Would that work?


SabataRH(Posted 2007) [#3]
.


Stevie G(Posted 2007) [#4]
See this post here ...

http://www.blitzbasic.com/Community/posts.php?topic=74265


stayne(Posted 2007) [#5]
Thanks Stevie. As long as the mesh isn't repeatedly tossed up and down between gravity and upwards acceleration (I have a water in/water out sound). I'll give it a shot after work today, thanks.


Stevie G(Posted 2007) [#6]
Well, even with the water in/out sound - only play it if the y velocity is greater than some threshold. Let me know how you get on.