About

The harvester is used to scan the vicinity for the poseballs and calculate their relative positions and relative rotations.

This is used because it is more convenient to arrange the poseballs for a given set of animations and then just click the harvester in order to collect data that can be placed into notecards.

Code

harvester.lsl
///////////////////////////////////////////////////////////////////////////
//  Copyright (C) Wizardry and Steamworks 2013 - License: GNU GPLv3      //
//  Please see: http://www.gnu.org/licenses/gpl.html for legal details,  //
//  rights of fair usage, the disclaimer and warranty conditions.        //
///////////////////////////////////////////////////////////////////////////
 
vector REFERENCE_POSITION = ZERO_VECTOR;
rotation REFERENCE_ROTATION = ZERO_ROTATION;
 
list poseballs = [ "m", "f" ];
list positions = [];
list rotations = [];
 
default {
    touch_start(integer total_number) {
        llOwnerSay("----- SWEEP -----");
        positions = [];
        rotations = [];
        llSensor("", "", ACTIVE|PASSIVE|SCRIPTED, 10, TWO_PI);
    }
    sensor(integer num) {
        --num;
        do {
            string name = llDetectedName(num);
            if(name == "[WaS-K] Chaise Longue") {
                REFERENCE_POSITION = llDetectedPos(num);
                REFERENCE_ROTATION = llDetectedRot(num);
                jump continue;
            }
            integer i = llListFindList(poseballs, (list)name);
            if(i == -1) jump continue;
            vector dd = -(REFERENCE_POSITION-llDetectedPos(num))/REFERENCE_ROTATION;
            vector dr = llRot2Euler(llDetectedRot(num) * <-REFERENCE_ROTATION.x,-REFERENCE_ROTATION.y,-REFERENCE_ROTATION.z,REFERENCE_ROTATION.s>)*RAD_TO_DEG;
            positions = llListInsertList(positions, (list)dd, i);
            rotations = llListInsertList(rotations, (list)dr, i);
@continue;
        } while(--num>-1);
        if(REFERENCE_POSITION == ZERO_VECTOR || REFERENCE_ROTATION == ZERO_ROTATION) {
            llSay(DEBUG_CHANNEL, "Unable to detect the [WaS-K] Chaise Longue in the vicinity.");
            llOwnerSay("ERROR");
            llOwnerSay("----- SWEEP -----");
            return;
        }
        integer j = llGetListLength(poseballs)-1;
        do {
            llOwnerSay(llList2String(poseballs, j) + " p=" + llList2String(positions, j) + " r=" + llList2String(rotations, j));
        } while(--j>-1);
        llOwnerSay("----- SWEEP -----");
    }
}

secondlife/poseball_system/scripts/harvester.txt ยท Last modified: 2017/02/22 18:23 (external edit)

Access website using Tor


For the copyright, license, warranty and privacy terms for the usage of this website please see the license and privacy pages.