Floating boat
by Dylan Nicholson · in Torque Game Engine · 07/05/2007 (4:21 pm) · 0 replies
Reposting from Questions thread...
New problem: I've changed from using a water texture on a flat terrain, to using a water object on a mountainous terrain - but the boat sinks to the bottom!
If I adjust the density of the boat to exactly match the amount it is submerged in the water (which is a real pain), I can get the mBuoyancy value to 1, which is supposed to prevent gravity, except there's a bug in the engine that it doesn't calculate the buoyancy before the first gravity calculation, so the net Z velocity is still non-zero. I fixed this by having it call updateContainer() on the first call to player::setTransform(), but now it seems the boat won't move in the x-y plane - it appears that only does this if it believes the item is on a surface - which of course it isn't! So maybe I need to be using a hover vehicle or something completely different? Vehicles are a problem because they require collision meshes, which I don't have, but if that's the only option I'll go with it.
Ideally the boat will move up and down with the wave motion, but if that's too hard I'll just make the wave motion sufficiently subtle for it not to be a problem.
New problem: I've changed from using a water texture on a flat terrain, to using a water object on a mountainous terrain - but the boat sinks to the bottom!
If I adjust the density of the boat to exactly match the amount it is submerged in the water (which is a real pain), I can get the mBuoyancy value to 1, which is supposed to prevent gravity, except there's a bug in the engine that it doesn't calculate the buoyancy before the first gravity calculation, so the net Z velocity is still non-zero. I fixed this by having it call updateContainer() on the first call to player::setTransform(), but now it seems the boat won't move in the x-y plane - it appears that only does this if it believes the item is on a surface - which of course it isn't! So maybe I need to be using a hover vehicle or something completely different? Vehicles are a problem because they require collision meshes, which I don't have, but if that's the only option I'll go with it.
Ideally the boat will move up and down with the wave motion, but if that's too hard I'll just make the wave motion sufficiently subtle for it not to be a problem.
About the author