YaK:: Scratch : Spinning Stuff (Experimental) [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
[mega_changes]
[photos]

Scratch: Spinning Stuff (Experimental)


float theta;
default
{
    state_entry()
    {
        llSetTimerEvent(0);
    }
    touch_start(integer a)
    {
        state spinning;
    }
}
state spinning
{
    state_entry()
    {
        theta= 0;
        llSetTimerEvent( 0.1 );
    }
    timer()
    {
        theta += 0.2;
        llSetRot( llEuler2Rot( <0.0, 0.0, theta> ) );
    }
    touch_start(integer a)
    {
        state default;
    }
}



state XXdefault
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
        llTargetOmega( <0,0,1>, 0, 1.0);
        llSetStatus(STATUS_ROTATE_Z, FALSE);
    }

    touch_start(integer total_number)
    {
        llSay(0, "Spinningd.");

        //llSetStatus(STATUS_PHYSICS, TRUE);
        llSetStatus(STATUS_SANDBOX, TRUE);
       // llSetStatus(STATUS_ROTATE_X, FALSE);
       // llSetStatus(STATUS_ROTATE_Y, FALSE);
        llSetStatus(STATUS_ROTATE_Z, TRUE);

        llSetHoverHeight(2.0, TRUE, 1.0);

        //llApplyImpulse(<0,0,1>, TRUE);
        //llApplyRotationalImpulse(<0,0,1>, TRUE);  dd

        //llSetPrimitiveParams(  [PRIM_ROTATION, <0, 0, 0, 1>]    );

        //llTargetOmega(vector axis, float spinrate, float gain)
        llTargetOmega( <0,0,1>, 0.5, 1.0);
        state spinning;
    }
}

state XXspinning
{
    touch_start(integer total_number)
    {
        llSay(0, "Stopping.");
        llTargetOmega( <0,0,1>, 0, 1.0);
        llSetStatus(STATUS_ROTATE_Z, FALSE);
        state default;
    }
}


(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2007-02-06)       [Login]
(No back references.)