Speedometer

Written by: Headmaster
float KPH_TO_MPH = 01.631;
 
default
{
    state_entry()
    {
        llSetTimerEvent(.2);
    }
 
    timer()
    {
        float speed = llVecMag(llGetVel())*60*60/1000;
        speed *= KPH_TO_MPH;
        if(speed > 130)
            speed = 130+llFrand(5.0);
        float ratio;
        if(speed < 20)
            ratio = speed/240;
        else
            ratio = (speed-10)/120;
        llRotateTexture((ratio*-290)*DEG_TO_RAD, ALL_SIDES);
    }
}

 

Category: