This creates a movement sort of like a floating lantern. But it needs a lot of work before I will consider it even close to done.
// V2 //
float limit = 10.0; // This is the radius that the object is allowed to drift up to.
// 20.0 == a 40 meter circle.
float offset = 0.0; // Use this float to offset the height of the object in relation to the water surface.
// The object will (when the offset is zero) float with its geometric center at the level of the water surface.
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
float float_height;
vector home;
FloatAbout(vector pos)
{
llSetTimerEvent(limit);
@a;
float num_x = (llFrand(limit / 2) - (limit / 4));
float num_y = (llFrand(limit / 2) - (limit / 4));
vector target = <(pos.x + num_x), (pos.y + num_y), float_height>;
if(llVecDist(target, home) <= limit)
llMoveToTarget(target, (limit * 1.5));
else jump a;
}
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
float_height = (llWater(ZERO_VECTOR) + offset);
llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y, FALSE);
llSetStatus(STATUS_PHYSICS | STATUS_PHANTOM, TRUE);
home = llGetPos();
llSetTimerEvent(0.1);
}
timer()
{
FloatAbout(llGetPos());
}
touch_end(integer nd)
{
if(llDetectedKey(0) == llGetOwner())
FloatAbout((home = llGetPos()));
}
}