llSetBuoyancy(float buoyancy)
Sets a
physical object's
buoyancy (
which seems to be an additional force, not unlike real-life buoyancy).
(
As of 2008-07-16, scripted buoyancy (this function) and normal hovering buoyancy are not working properly on avatars in SL's implementation of Havok4. Specially, if you use this function, consider your avatar to be sinking, at different speeds depending on what key you press and on wether you are in standing state after having landed or not. llApplyImpulse and llSetForce are ineffective against that. If you want this to change, vote for bug / SVC-1792 and its related bug / SVC-2013.)
The default
buoyancy for an object is 0. Setting this to exactly 1 will cause the object to float as if no
gravity exists.
Values greater than 1 will cause the object to float up, while values between 0 and 1 mean a gentler than regular fall, the closer to 0 the closer to normal behavior. Setting a negative value will simulate a downward force, which will also cause the affected
prim/object to vibrate a lot more on the ground while the
physics engine tries to "settle" it.
Behavior not unlike
llSetForce, as well as the constant use of
energy by this
function, would suggest that buoyancy internally works by applying extra (
mass-proportional) force, either up or down, while gravity still works (hence the energy use while floating).
Notes:
- Heavy objects cause a lot of energy use: a physical object over about 90kg will not be able to hover due to energy expenditure, depending a little on how much motion other energy loss) it's experiencing. If the object is too heavy, see if there are any prims that can be hollowed.
- There seems to be no way to get the buoyancy value (llGetBuoyancy). (Likely related to the physics engine interaction; apparently vehicle buoyancy acts separately from regular buoyancy.)
- Buoyancy does not take into account water level. A buoyancy of 1.5 will cause the object to float up the same rate whether it is under or above water. (Water only has limited meaning in SL and seems to exist mostly as a height and a 'what to hover over' option in scripts. The name "buoyancy" may be a little misleading since in real life gravity tends to significantly affect objects, while bouyancy only gets into things when a solid is in a liquid, gas in a gas, etc. This function allows buoyancy to be changed with solids in anything (air, since water doesn't really exist) which is a bit odd.
- Real-world buoyancy affects any matter that is displacing other matter in a gravitational field. It's just almost impossible to notice except when the densities or the two substances are close. The "correct" way for buoyancy to behave would be to calculate an object's displacement based on volume and the density of the material being displaced (remembering to account for altitude). To get a more accurate buoyancy result, a lot more is necessary than a simple llSetBuoyancy call.
This article wasn't helpful for you? Maybe the
related article at the LSL Portal is able to bring enlightenment.
Functions |
Dynamics