Buoyancy

Blitz3D Forums/Blitz3D Beginners Area/Buoyancy

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The cube should settle automatically - you just need to make sure that when in water it's upwards acceleration / force ( bouyancy ) is slightly higher than it's downwards acceleraton / force ( gravity ).

const TIMESTEP# = .005
const Gravity# = 9.8
global Bouyancy# = 10.2

[loop]

Acceleration = Acceleration - Gravity
If entityy( CUBE ) < WATERLEVEL
   Acceleration = Acceleration + Bouyancy
endif

translateentity CUBE, 0, Acceleration * TIMESTEP, 0

[loop]


Just vary the bouyancy factor to have objects surface quicker or slower etc..

Having it stop after a set amount of iterations won't look very good imo.

Stevie