Bug in llWater

Creating scripts
Post Reply
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Bug in llWater

Post by Mike Lorrey »

llWater() function is not returning the proper water height. In SLexit, we have the water set at the standard depth in the sim. I have a sailboat set on the water level. The llWater function thinks that the water is 20 meters below it, i.e. it is getting a null return of 0.
User avatar
Kayaker Magic
Posts: 354
Joined: Sun Dec 01, 2013 8:40 am
Has thanked: 52 times
Been thanked: 393 times

Re: Bug in llWater

Post by Kayaker Magic »

Can you write a short example script that demonstrates the problem?
I find that llWater works exactly as it should and have many scripts that use it successfully.
I tried to write a small example script to test it, and it continues to work well for me.

Code: Select all

//test llWater
// letting the test run to the end would take 9 hours,
//because it does a test every 0.5 seconds
//testing a different square meter every time.
//But if it finds an error at any step it prints something immediately.
//For me, it never displays any errors....
vector abspos=<0.5,0.5,0>;
default
{
    state_entry()
    {
        llSetTimerEvent(0.5);
    }

    timer()
    {
        float wat=llWater(abspos-llGetPos());     //llWat requires a delta value
        if (llFabs(wat-20.0)>0.01)         //if the water height anywhere is not 20
            llOwnerSay("llWater failed! "+(string)wat);
        abspos.x += 1.0;
        if (abspos.x>256.0)
        {
            abspos.x = 0.5;
            abspos.y += 1.0;
            if (abspos.y>256.0)
            {
                llOwnerSay("done");
                llSetTimerEvent(0.0);
            }
            llOwnerSay((string)abspos);
        }
    }
}
User avatar
Mike Lorrey
Posts: 361
Joined: Sun Sep 04, 2016 5:40 pm
Has thanked: 71 times
Been thanked: 269 times

Re: Bug in llWater

Post by Mike Lorrey »

Referring to a number of sailboat scripts from SL, as well as the SPD sailboat scripts that are based on the Taco sailboat, which function well in Inworldz, it appears that, assuming these sailboats were working where they were scripted, that llWater was implemented differently. The SPD scripts from Inworldz, when you sit on the boat, starts rapidly hopping between the surface and 20 meters above the surface. I managed to fix this, as the code was taking the llWater level and adding 20 meters with the llSetPos() function, when the engine was then returning it to the water level, resulting in this ping pong effect. Anyways, the sailboat scripts are working fine in Kitely when you use the Bullet physics engine on your region. ODE is not workable due to the original coder simply giving up on the linear motor parameters, even commenting in the code that he cannot reconcile the linear motor function with gravity.
Post Reply