Don't click here unless you want to be banned.

LSL Wiki : llSetScale

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawling22.us.archive.org
llSetScale(vector scale)

Sets the prim's scale (size). Prim size restrictions apply: maximum 10m, minimum 0.01m in any direction (Havok limit). Scaling a prim larger than 10m will cause it to scale up to 10m. Scaling a prim to less than 1cm will cause it to silently fail. Scaling a prim in a linkset causes a silent failure if the scale change will cause the object to exceed the link distance.

Physical prims cannot change their scale, as that would change their mass as well.

A prim's scale can be retrieved using llGetScale.

llSetScale has been supplemented, though not replaced, by llSetPrimitiveParams.

Q: Does this function work on attached objects?
A: Yes, llSetScale does work on attached objects. As does llSetPrimitiveParams. You can chain multiple commands together to execute all at once with llSetPrimitiveParams

Resizing Linked Sets:
In a linked object, this function only changes the size of the prim the script is in. There is no simple way to scale a whole linked object. Scale each individual child prim and adjust its position in relation to the parent prim.

Example:

Put this script into each prim of the object:
default {
    link_message(integer sender_num, integer num, string str, key id) {
        float scale; // size factor
        list    primparams;
        
        scale = (float)str;
        
        primparams = [];
        
        primparams += [PRIM_SIZE, llGetScale() * scale]; // resize
        
        if (llGetLinkNumber() > 1) { // only move if we're not the root object
            primparams += [PRIM_POSITION, llGetLocalPos() * scale]; // reposition
        }
        
        llSetPrimitiveParams(primparams);
    }
}

And this script into the parent prim of the linked set:
// rescales the linked set by the specified factor. factor > 1 makes it larger, < 1 smaller
// example: "/9 2.5"
Resize(float scale) {
    integer num_prims = llGetNumberOfPrims();
    integer i;

    for (i = 1; i <= num_prims; i++) { // first prim in a linked set is 1
        llMessageLinked(i, 0, (string)scale, NULL_KEY);
    }
    
}

default {
    state_entry() {
        llListen(9, "", llGetOwner(), "");
    }
    
    listen(integer channel, string name, key id, string message) {
        float scale;
        
        scale = (float)message;
        if ( scale == 0.0 ) return; // we don't resize by factor 0.0

        llSay(0, "Resizing by factor " + (string)scale);

        Resize(scale);
    }
}

Functions | Dynamics | Scale
There are 127 comments on this page. [Display comments/form]