Fluid And Ship

starkman
Posts: 7
Joined: Wed May 16, 2012 5:09 am

Fluid And Ship

Post by starkman »

Hi every one , :)
i want to use bullet physics to simulate ship behaviors on the water
-so i try to use HfFluid codes to simulate the water(fluid) and then i put a car vehicle on it !(i use AppVehicleDemo code to make my vehicle car), then i drop my vehicle on HftFluid ,

in finally buyoncy worked good and my car stay over the water , but when i add a force to ship(car) it not move to front

NOTE:
i try to use this code to make chaises body ship

btConvexShape* colShape = new btBoxShape(btVector3(5,0.5,5));
btHfFluidBuoyantConvexShape* buoyantShape = new btHfFluidBuoyantConvexShape(colShape);
buoyantShape->generateShape (btScalar(0.25f), btScalar(0.05f));

etc..

and i not use this local code :

Code: Select all

localCreateRigidBody(80,tr,compound);//
also i use this code to add my vehicle to fluid worlds:

Code: Select all

fluidDemo->getHfFluidDynamicsWorld()->addRigidBody(m_carChassis); // 
m_vehicleRayCaster = new btDefaultVehicleRaycaster(fluidDemo->getHfFluidDynamicsWorld());// is this way to ray cast fluid surface true ?
m_vehicle = new btRaycastVehicle(m_tuning,m_carChassis,m_vehicleRayCaster);
///never deactivate the vehicle
m_carChassis->setActivationState(DISABLE_DEACTIVATION);
fluidDemo->getHfFluidDynamicsWorld()->addVehicle(m_vehicle);//
it's mean problem is here:
m_vehicleRayCaster = new btDefaultVehicleRaycaster(fluidDemo->getHfFluidDynamicsWorld());
the car will not cast the fluid surface and so not move

but i don't know how to fix that to raycast fluid surface.
it's my simple way but is there any other code or way to put ship vehicle on the HftFluid and ride it ?
can any one help me?

Thank you so much for your answers .