Game Development Community

Underwarter level?

by James Bond · in Torque Game Engine · 05/15/2005 (11:20 pm) · 6 replies

I cant for the life of me work out how to keep my player floating underwater. I am using a flying vehicle code (because it gives me the control set up i wanted) but when the player is idle it floats to the surface.
How can I force it to stay submerged?

#1
05/15/2005 (11:23 pm)
I believe you can control the density of an object, which affects bouyancy.
#2
05/16/2005 (12:11 am)
So how do i go about changing this then? is it something to do with the mass?
#3
05/16/2005 (2:19 am)
I believe it's a property of the player datablock. Try calling dump() on the datablock for the player to see what properties there are for you to tweak.
#4
05/16/2005 (10:35 am)
It is in the datablock

density = 10; was the default.

Try lowering this value. There is also a density for the waterblock I think. The issue I ran into is if the player starts to float he no longer can move and gets stuck. This could be fixed easily I'm sure with some code to handle water movement, but I never tried seeing we dont need it yet.

If you want the player to float in place underwater (ie not sink or float to the top) I believe you have to set the water density and player object density to be equal.
#5
05/16/2005 (11:45 pm)
Thanks Guys,
I still havn't figured it out, but you have helped me. I think im going to look into writing an underwater movement code.
-James
#6
05/17/2005 (12:14 am)
Don't ask me to explain this because i can't. However i seem to have cracked it. I was messing around with teh density of my water block and my vehicle, and the right balance come with the water having dencity = 0 and my vehicle with a density = 3.0.
-James.