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

LSL Wiki : llSetScale

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

Sets the prim's scale (size). Prim size restrictions apply: maximum 64m, minimum 0.01m in any direction (Havok limit). Scaling a prim larger than 64m will cause it to scale up to 64m. 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);
    }
}

This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Dynamics | Scale
Comments [Hide comments/form]
Does llSetScale only work on the parent prim? Can't seem to get it on more than the parent prim if its a set of linked prims I'm changing.
-- MagicianThorn (2004-08-03 14:38:05)
It'll work on child prims, but the behavior can be iffy at rare times. Check out my Rocketeer (in Blue), the hatch uses llSetScale (click the blue button to open/close it). Occasionally, when building the rocket/script, it wouldn't always work. But once it DID work, it seems to always work. Simply resetting the script (in the child) seems to fix it if it glitches and stops scaling. Make sure the llSetScale script is in the child.
-- BosozokuKato (2004-08-04 10:01:54)
I have an exactly 50% success rate with this on child prims. Two linked children, both linkmessaged to change scale (with llSetPrimitiveParams, or with llSetScale), and one of them scales whereas the other doesn't. It's intermittent which scales and which doesn't.
-- SeifertSurface (2005-11-29 01:40:28)
There is a scroll bar to the side to move down the script.:}
-- CidJacobs (2005-12-06 20:47:53)
Um...<blush> thanks.
-- HotTempura (2005-12-10 16:14:01)
Now that attachments are movable, whether or not those functions work in attachments is worth testing. I'll do so ASAP, but I cant get in SL this week.
-- ChristopherOmega (2006-04-03 07:14:07)
The thing I was getting a 50% success rate with - I think it could have been scaling things such that the linkset was then too big to stay linked...so it crashed the script instead. SetScaling in child objects still seems to intermittently kill scripts though, I switched to using listens (as opposed to link messages) and unlinked prims.
-- SeifertSurface (2006-04-12 02:14:10)
I have found that 'llSetPrimitiveParams()' DOES work in attachments. I just wrote a script to change attachment shape yesterday, and it worked beautifully.
-- HeweeZetkin (2006-08-29 15:52:00)
This is actualy known, LL a couple versions back re-enabled llSetPrimitiveParams on attachments.
-- BlindWanderer (2006-08-30 23:08:39)
Then why doesn't this page reflect that?
-- LallanderParvenu (2006-10-24 14:31:30)
Knowing the facts and knowing where changes need to be made are two different things. There is a page that lists recent comments, but not a page to list inaccuracies. I'll fix the page :p
-- BlindWanderer (2006-10-24 18:18:46)
Am I missing something here?
Couldn't all the code inside the Resize() procedure be simplified by using LINK_SET?
Example:
Resize(float scale)
{
llMessageLinked(LINK_SET, 0, (string)scale, NULL_KEY);
}
-- Jadz0rConover (2007-05-24 22:31:06)
Can't this fucntion chage one side size?
not both side.
-- 61-31-134-237.dynamic.tfn.net.tw (2007-08-11 20:07:18)










--


How can this stupid spam be deleted?














--
-- c-67-191-214-56.hsd1.ga.comcast.net (2007-11-02 06:04:30)
Attach a comment to this page: