Table of Contents

About

Huggable toys are created using an animation applier script and an animation that raises the arm of the avatar for the visual effect. An example script can be found in the code section and is responsible for nothing more other than applying the animation.

Animation

The animation in BVH format used:

Code

///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2021 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
default
{
    state_entry() {
        llSetTimerEvent(1);
    }
    run_time_permissions(integer perm) {
        if (perm & PERMISSION_TRIGGER_ANIMATION) {
            llStartAnimation(
                llGetInventoryName(
                    INVENTORY_ANIMATION, 
                    0
                )
            );
        }
    }
    timer() {
        llRequestPermissions(
            llGetOwner(), 
            PERMISSION_TRIGGER_ANIMATION
        );
    }
    changed(integer change) {
        llResetScript();
    }
    on_rez(integer num) {
        llResetScript();
    }
}