Animated Attachments Test

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

llTargetOmega

  • Create 3 boxes and color the top sides red.
  • Link 2 of the boxes together.
  • Add the following script to both objects and verify the objects are spinning counterclockwise with the red sides still on top.
//llTargetOmega script
default
{
    state_entry()
    {
        llTargetOmega(<0,0,1>, 2, 1);
    }
}
  • Attach the objects to your avatar.
  • Verify the objects are still spinning counterclockwise with the red sides still on top.
  • Edit the script and change the 2 to -2.
  • Verify the objects spin in the clockwise direction.
  • Add the following script to 2 boxes.
default
{
    state_entry()
    {
    llOwnerSay("spin off");
    llTargetOmega(<0,0,1>, 0, 0);
    }

    touch_start(integer total_number)
    {state spin;}
}

state spin
{
    state_entry()
    {
    llOwnerSay("spin on");
    llTargetOmega(<0,0,1>, 2, 1);
    }

    touch_start(integer total_number)
    {state default;}
} 
  • Link the boxes together.
  • Touch each of the boxes and verify they start and stop spinning.
  • Attach the object
  • Touch each of the boxes and verify they start and stop spinning.
  • When both boxes are spinning around their own center, teleport to a different sim.
  • Verify both boxes are still spinning around their own center.


llSetRot

  • Create 3 boxs and color the top sides red.
  • Link 2 of the boxes together.
  • Add the following script to both objects and verify the objects are spinning counterclockwise with the red sides still on top.
//llSetRot script
float counter = 0;
default
{
    state_entry()
    {
        while(1)
        {
            llSetRot(llEuler2Rot(<0,0,counter>));
            counter = counter + 0.1;
            if (counter > TWO_PI) counter = 0;
        }
    }
}
  • Attach the objects to your avatar.
  • Verify the objects are still spinning counterclockwise with the red sides still on top.
  • Edit the script and change the 0.1 to -0.1.
  • Verify the object spins in the clockwise direction.


llSetLocalRot

  • Create 2 boxs, one above the other.
  • Color the North face of the bottom box red.
  • Color the Top face of the top box green.
  • Select the top box, then the bottom box, and link them together.
  • Add the following script to the child(top) box (select Edit Linked Parts to do this)
//SetLocalRot script
float counter = 0;
default
{
    state_entry()
    {
        while(1)
        {
            llSetLocalRot(llEuler2Rot(<0,0, counter>));
            counter = counter + 0.2;
            if (counter > TWO_PI) counter = 0;
        }
    }
}
  • Add the following script to the root object.
//SetLocalRot script
float counter = 0;
default
{
    state_entry()
    {
        while(1)
        {
            llSetLocalRot(llEuler2Rot(<0,counter, 0>));
            counter = counter + 0.2;
            if (counter > TWO_PI) counter = 0;
        }
    }
}
  • Attach the object to your head
  • Verify the red side of the root object rotates from top to left shoulder to chest to right shoulder
  • Verify the child object rotates along with the root object and also rotates around it's own green face


llSetPos

  • Create 2 boxes and link them together.
  • Edit the child object (with Edit Linked Parts) and add the following script.
default
{
    state_entry()
    {
        llSay(0, "Hello, Avatar!");
    }

    touch_start(integer total_number)
    {
        float x = llFrand(40);
        float y = llFrand(40);
        float z = llFrand(40);
        llOwnerSay((string)x +", "+ (string)y +", "+ (string)z);
        llSetPos(<x,y,z>);
    }
}
  • Click the child object a few times.
  • Verify that the child object's position is restrained to 20m from your avatar.


Areas to expand this script:

llSetScale

llGetScale

llGetLocalPos, llGetRootPosition

llGetRot, llGetRootRotation, llGetLocalRot

Performance

  • Make animated attachments that can be activated/deactivated by anyone shouting "on" or "off"
  • Get 20 people together wearing the animated attachments
  • Turn all the attachments on and off, and compare your framerate and network traffic.
  • Is your framerate affected?
  • Is your network traffic significantly higher?