Game Development Community

Does anyone know how to make the player float in water?

by Daniel J Lee · in Torque Game Engine · 08/17/2002 (1:14 am) · 7 replies

Please if you have any ideas, let me know.

Thanks.

Daniel

#1
08/19/2002 (8:45 pm)
Give him a life vest ;)
#2
08/19/2002 (9:32 pm)
Well from my glance over of the player physics, boyancy in Torque only seems to be a 'factor' in determining the speed at which a player falls through water, regardless, the player will continue to fall.

You could change this a couple of ways but here is how I would do it:
1) Determine the speed at which the player is falling
2) Calculate surface area of falling object (this can be done a number of ways too, including hacks, probably the best way to do this is make it a modifier in the object datablock)
3) Slowly reverse the falling vector and speed until speed becomes zero.. at which point you'll want to continue to apply an upward force on the object equal to that of the falling vector(or just zero out the falling velocity ;)
#3
08/19/2002 (11:58 pm)
Thanks!

I have it working nicely... I didn't give him a life vest though... ^^

Thanks.
#4
08/29/2002 (11:30 am)
Does he float or sit still in mid air?
#5
11/13/2002 (3:26 pm)
Daniel,

How did you accomplish this?
#6
11/13/2002 (6:33 pm)
Hmmm.. I believe that if you change the water density field to a high enough value, the player will float. You'll be unable to move around at that point though. i.e. you'll get stuck on the water.
#7
11/14/2002 (9:10 pm)
now way this is easy..
write one function in the code
as this guy already knows when he is in water

the tough part is all the animations to make it real