Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Scale an object

Ryder Spearmann
Early Adopter
Join date: 1 May 2006
Posts: 216
08-26-2007 09:49
Hi all...

I want to scale a linked object with code... along selected axis... I guess this will require all prims to scale and move themselves?

Anyone seen code for this?

Is there an easier way?

TYVM
Damet Neumann
Registered User
Join date: 21 Apr 2006
Posts: 140
llSetScale
08-26-2007 09:58
i believe is what your looking for

llSetScale(vector scale)
Day Oh
Registered User
Join date: 3 Feb 2007
Posts: 1,257
08-26-2007 10:01
There is a solution on the lslwiki.net page for llSetScale: http://www.lslwiki.net/lslwiki/wakka.php?wakka=llsetscale

From: someone
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);
}
}
_____________________
Simil Miles
Creator
Join date: 1 Mar 2007
Posts: 300
08-26-2007 10:06
You have to resize and reposition each prim.
Let me try to script it.

EDIT : ok it's doable but is made more complicated with the requirement of a script in each prim until llGetLinkPrimitiveParams is implemented.
https://jira.secondlife.com/browse/SVC-224

I might release such script in the future.
_____________________
UnConWTech @ Flo (144, 84, 224) http://unconwtech.free.fr

SL books http://astore.amazon.com/secondlife-sl-20/

Need a beta tester for quality assurance ?
Need a translator for English, French, Spanish ?