Page 1 of 1

Water, Bullet: buoyancy

Posted: Mon Jul 07, 2025 5:51 pm
by slapin

Hi, all!

Is there some bullet water buoyancy implementation I could use made for Bullet and Ogre?
My water is going to be btPairCachingGhostShape below water plane, and the vessel is btRigidBody. Distant vessels are not physical so they don't bother.
I drag my water with camera anyway keeping height at zero.


Re: Water, Bullet: buoyancy

Posted: Tue Jul 08, 2025 12:47 pm
by sercero

Did you look into the Bullet forums?

Urho3D has a buoyancy example and they use bullet if I'm not mistaken


Re: Water, Bullet: buoyancy

Posted: Fri Jul 11, 2025 10:39 am
by slapin

Well, Bullet forums are fruitless on the subject, but I know the theory - I just need Ogre's (not Bullet's) AABB for the entity and current transformed UP vector (node->getRotation() * Ogre::Vector3::UNIT_Y), also I need actual position in 3D. This way I can calculate 4 points on the node on which I check water level using simplified sine formula I use in shader for a surface and time. Knowing water level at each of 4 points, the height of AABB we can calculate how much submerged that point is and upward force at that point. If the body is kinematic it can be just upward velocity/angular velocity.


Re: Water, Bullet: buoyancy

Posted: Fri Jul 11, 2025 10:49 am
by slapin

Urho is dead for a long time.


Re: Water, Bullet: buoyancy

Posted: Fri Jul 11, 2025 12:41 pm
by sercero
slapin wrote: Fri Jul 11, 2025 10:49 am

Urho is dead for a long time.

Sort of, you still have the rebel fork: https://github.com/rbfx/rbfx

Here is their example of buoyancy: https://github.com/Lumak/Urho3D-Buoyancy/tree/master