Boat in water
by PGames · in Torque 3D Professional · 02/28/2010 (4:25 am) · 11 replies
So I have my boat successfully floating in water, but there are 2 problems, one is it takes a bit for the physics to set to normal, so the boat will bounce a bit every time that level starts. Is there any way to fix that?
Another thing is that the water plane right now clips right through the boat, so the part of the boat that's below the water plane is actually under water, is there a way to fix this?
Another thing is that the water plane right now clips right through the boat, so the part of the boat that's below the water plane is actually under water, is there a way to fix this?
#2
Tnx :-)
02/28/2010 (4:34 am)
Hi there Zifei, how have you set up the boat to float in water? Is there some info you can share about how to set up this?Tnx :-)
#3
It's datablock is like this:
//start boat datablock
datablock PxMultiActorData( pxStartBoat )
{
category = "Physics";
shapeName = "art/shapes/items/general/start_boat.dae";
physXStream = "art/shapes/items/general/start_boat.xml";
// pxMaterial = PxMaterial_Default;
noCorrection = true;
waterDragScale = 3;
buoyancyDensity = 0.2;
angularDrag = 0.2;
linearDrag = 0.2;
clientOnly = false;
singlePlayerOnly = true;
};
02/28/2010 (6:14 am)
I have a regular setup with physx. The collision is just a box around the boat right now, it's set to dynamic. I take that's the wrong setup.It's datablock is like this:
//start boat datablock
datablock PxMultiActorData( pxStartBoat )
{
category = "Physics";
shapeName = "art/shapes/items/general/start_boat.dae";
physXStream = "art/shapes/items/general/start_boat.xml";
// pxMaterial = PxMaterial_Default;
noCorrection = true;
waterDragScale = 3;
buoyancyDensity = 0.2;
angularDrag = 0.2;
linearDrag = 0.2;
clientOnly = false;
singlePlayerOnly = true;
};
#4
02/28/2010 (7:00 am)
Personally I would have gone with a vehicle class, create invisible wheels, so that it rides over the terrain, so you could have a boat that can crash or drift into dry land, add some height elements into it, and add the physics in there for your collision, maybe damage.
#6
Unfortunately, it would not. With the boat in the proper place, the two geometries (boat and water) simply intersect here.
This isn't a trivial problem. The easiest solution is to construct the boat and place it such that this can't happen.
The proper solution of not making the water render inside the boat is more tricky. One way is as a rendering trick where the boat is rendered on top of the water which, with advanced lighting, would require some tricky messing around with the rendering pipeline.
03/02/2010 (2:19 am)
Unfortunately, it would not. With the boat in the proper place, the two geometries (boat and water) simply intersect here.
This isn't a trivial problem. The easiest solution is to construct the boat and place it such that this can't happen.
The proper solution of not making the water render inside the boat is more tricky. One way is as a rendering trick where the boat is rendered on top of the water which, with advanced lighting, would require some tricky messing around with the rendering pipeline.
#7
I am having the same difficulties with water inside a boat. I was thinking about some sort of collision mesh which could prevent the water being rendered inside the boat. I don't know if it works but maybe someone could give it a thought if it can be done in such way.
03/02/2010 (3:26 am)
Quote:What sort of collision mesh do you have?
I am having the same difficulties with water inside a boat. I was thinking about some sort of collision mesh which could prevent the water being rendered inside the boat. I don't know if it works but maybe someone could give it a thought if it can be done in such way.
#8
Punching an arbitrary hole into this surface would be complicated at best. The simplest way would be to render the boat over the water once the water has rendered but this is tricky to set up. The object has to render properly into the zbuffer, ignoring z depth from the water while having valid z tests for itself and ending up with a valid zbuffer.
03/02/2010 (3:37 am)
Collision and rendering is separate. Collision affects simulation but not the geometry of the water object. Water objects are generated as grids that are then animated in vertex shaders.Punching an arbitrary hole into this surface would be complicated at best. The simplest way would be to render the boat over the water once the water has rendered but this is tricky to set up. The object has to render properly into the zbuffer, ignoring z depth from the water while having valid z tests for itself and ending up with a valid zbuffer.
#9
By far the easiest solution would be to not do a boat simulation but rather a sinking boat simulation :)
03/02/2010 (3:38 am)
By far the easiest solution would be to not do a boat simulation but rather a sinking boat simulation :)
#10
03/02/2010 (5:53 pm)
Is there a way to setup a shape and say inside this shape's space, do not render the waterplane?
#11
Nope, that's the "punching an arbitrary whole into this surface" thing I talked about above.
Your best bet is to solve this in the rendering stage by rendering on top, stenciling, or something similar.
03/02/2010 (6:00 pm)
Nope, that's the "punching an arbitrary whole into this surface" thing I talked about above.
Your best bet is to solve this in the rendering stage by rendering on top, stenciling, or something similar.
Torque Owner Jules
Something2Play
What sort of collision mesh do you have?