Page 1 of 1

Simple boat buoyancy demo

Posted: Wed Jun 09, 2010 1:42 pm
by robagar
Here's a short demo of a boat sailing through waves on an unbounded ocean. Buoyancy is modelled by attaching floats to the body which simply apply a force acording to their depth below the surface at discrete points. The ocean surface is functionally generated, so it is infinite in extent. Replacing the quick + simple but completely wrong sine waves with something more physically correct is on my todo list, as is making a better boat model :)

Note this is not using the technique demonstrated in HeightFieldFluidDemo, which models the water as a finite heightfield.

Re: Simple boat buoyancy demo

Posted: Thu Jun 10, 2010 9:31 am
by Flix
Nice video and physic effect :) !

Code: Select all

Buoyancy is modelled by attaching floats to the body which simply apply a force acording to their depth below the surface at discrete points.
Could you please explain a little further the approach you used ? From what you've written I presume you attached some rigid bodies (how many, which shape, where, with which constraint?) to the boat rigid body so that you can apply a force on each of them at every internal timestep proportional to the body distance from the water surface. Correct?

I'm not asking any source code, just a further explanation of one line or two. Thank you in advance.

Flix.

Re: Simple boat buoyancy demo

Posted: Fri Jun 11, 2010 8:20 am
by robagar
Cheers! :D

The floats are not real Bullet bodies - they are imaginary things attached to points on my boat object.

Code: Select all

boat
  + btRigidBody
  + Ogre renderable
  + floats
But yes, in the timestep the each float tests the water level at their position, then applies a force to the boat's rigid body at their position relative to the boat. I imagine each float as a cylinder which is always vertical, regardles of the orientation of the boat. The force is proportional to how deeply immersed they are, up to a maximum defined by their volume.

At the moment the boat has just 4 floats - bow, stern, port & starboard. I manually set their volumes to provide enough force to counteract gravity, and then adjust the positions and cylinder lengths to tweak the way the boat moves. I've got a vague idea to generate the floats by packing cylinders into the rigid body volume somehow, but that's something for the future :)

Re: Simple boat buoyancy demo

Posted: Sun Jun 13, 2010 7:12 am
by Flix
Thank you for your explanation :D !

Re: Simple boat buoyancy demo

Posted: Tue Jun 22, 2010 1:59 pm
by robagar

Re: Simple boat buoyancy demo

Posted: Wed Aug 18, 2010 1:23 pm
by jinij123
Could anybody send me a sample code on how to proceed to make a similar sample as shown by robagar?
I would like to use OgreBullet framework for making this.

Thanks in advance.

Re: Simple boat buoyancy demo

Posted: Mon Nov 04, 2013 2:58 pm
by gtafan
I would also like to see the sorcecode of this boat buoyancy demo.

Re: Simple boat buoyancy demo

Posted: Mon Nov 04, 2013 3:13 pm
by c6burns
Considering his last visit to the forum was 2 years ago, you might have to be contented with his explanation instead of his source.

Re: Simple boat buoyancy demo

Posted: Mon Nov 04, 2013 3:43 pm
by gtafan
c6burns wrote:Considering his last visit to the forum was 2 years ago, you might have to be contented with his explanation instead of his source.
I donĀ“t realy expected the topicstarter to give me the sorces, but may be the sources, even posible modified, are avaible somewhere and someone can say where to find them.

Re: Simple boat buoyancy demo

Posted: Wed Mar 10, 2021 7:00 am
by Leith
I'm happy to follow this up, if nobody else cares to, and hi, Erwin!

Re: Simple boat buoyancy demo

Posted: Mon Nov 15, 2021 9:02 am
by wanglei
interestingļ¼