llSetScale(vector scale)
Sets the
prim's scale (size). Prim size restrictions apply: maximum 64
m, 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:
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