Monday, March 29, 2010

March Madness Challenge - Day 29

A little more experimenting with Second Life. Decided to work with LLSetPrimtive. It allows for the changing of many of the prim options. This code tests scale, rotation, and changing the location of the prim. For fun my avatar was being harassed by a Dalek, and I sat on the test object and took a ride. The machine wasn't powerful enough to take a nice smooth video so this will have to do.

This code could be crossed with the httpserver mechanism and it could be controlled from outside of Second Life.

http://www.youtube.com/watch?v=eZWtsDzr0Qw



// touch to trigger binary actions involving llSetPrimitiveParams

integer trigger=FALSE;

default
{
    touch_start(integer nn)
    {
        if (trigger==FALSE)
        { 
            llSetPrimitiveParams([PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75] ); 
            llSetPrimitiveParams([PRIM_SIZE, <0.5, 0.5, 0.5>]);
            llSetPrimitiveParams( [PRIM_ROTATION, ZERO_ROTATION] );
            rotation  yrot =  llEuler2Rot( < 0, 15 * DEG_TO_RAD, 0 > );
            integer ii;
            for (ii = 0; ii < 59; ii++)
            {
                llSetPrimitiveParams( [PRIM_ROTATION, llGetRot() * yrot] );
            }
            llSetPrimitiveParams([PRIM_POSITION, llGetPos() + <0,0,1>]); 
            trigger=TRUE; 
        }
        else
        { 
            llSetPrimitiveParams([PRIM_POINT_LIGHT, FALSE, <1, 1, 1>, 1.0, 10.0, 0.75] );
            llSetPrimitiveParams([PRIM_SIZE, <2, 2, 2>]);
            integer ii;
            integer increase;
            for (ii = 0; ii < 50; ii++)
            {
                llSetPrimitiveParams([PRIM_POSITION, llGetPos() + <0,0,1>]); 
            }

            for (ii = 0; ii < 50; ii++)
            {
                llSetPrimitiveParams([PRIM_POSITION, llGetPos() + <0,0,-1>]); 
            }
            trigger=FALSE;
        }
    }
}

No comments: