Btw, the code you want is in the physics_handle sub:
_physics_handle:
`
rem create a boyancy force effect below waterline
waterlevelangle#=wrapvalue(waterlevelangle#+1.0)
waterlevel#=cos(waterlevelangle#)
for objid=10 to objidmax
rem boyancy force
forcex#=0.0
forcey#=0.0
forcez#=0.0
mass#=phy get rigid body mass(objid)
if object position y(objid)<0
rem hit water line
forcey#=(abs(object position y(objid))*mass#)/2.0
phy set rigid body angular damping objid,0.1+abs(object position y(objid)/2.0)
phy set rigid body linear damping objid,0.1+abs(object position y(objid)*4)
endif
if splashmax>0
if object position y(objid)<0 and objid>11
rem splash
if crate(objid)=0
for s=1 to splashmax
if splash(s)=0
splash(s)=10
posx#=object position x(objid)
posz#=object position z(objid)
play sound 10+s : position sound 10+s,posx#,waterlevel#,posz#
set sound speed 10+s,18000+rnd(3000)
exit
endif
next s
crate(objid)=1
endif
endif
endif
rem small water/wave influences
if object position y(objid)<waterlevel#
forcey#=forcey#+(rnd(500)/100.0)*(mass#/200.0)
endif
phy add rigid body force objid,forcex#,forcey#,forcez#,1
next objid
`
rem handle splashes
if splashmax>0
for s=1 to splashmax
if splash(s)>0
splash(s)=splash(s)-1
endif
next s
endif
`
return
So what actually makes the objects go up is this:
if object position y(objid)<0
rem hit water line
forcey#=(abs(object position y(objid))*mass#)/2.0
phy set rigid body angular damping objid,0.1+abs(object position y(objid)/2.0)
phy set rigid body linear damping objid,0.1+abs(object position y(objid)*4)
endif
Simplified:
if object is below water height position
{
calculate force to forcey# variable
set body damping to simulate buoyancy
}