Skip to content
lsl.devlsl.devLSL Dev

llScaleByFactor

function
Function syntax
integer llScaleByFactor(
  1. float scaling_factor// Multiplier scale factor to apply to the prim sizes and their local positions.
);
Returns
integer
Energy
10

Attempts to resize the entire object by scaling_factor, maintaining the size-position ratios of the prims.

Resizing is subject to prim scale limits and linkability limits. This function can not resize the object if the linkset is physical, a pathfinding character, in a keyframed motion, or if resizing would cause the parcel to overflow.

Returns an integer TRUE if it succeeds, FALSE if it fails.

How to use
integer result = llScaleByFactor(0.0);
  • Due to floating point precision issues (often, sqrt(x*x) != x), avoid rescaling by the values returned by llGetMinScaleFactor and llGetMaxScaleFactor. To guarantee successful rescaling, use values slightly within the limits returned by those functions.
Example 1
21 collapsed lines
// Touching this script causes the object to double or halve in size.
integer growing;
default
{
state_entry()
{
llSay(PUBLIC_CHANNEL, "Touch to toggle scale.");
}
touch_start(integer num_detected)
{
growing = !growing;
float min_factor = llGetMinScaleFactor();
float max_factor = llGetMaxScaleFactor();
llSay(PUBLIC_CHANNEL, "min_scale_factor = " + (string)min_factor
+ "\nmax_scale_factor = " + (string)max_factor);
integer success;
if (growing) success = llScaleByFactor(2.0);
else success = llScaleByFactor(0.5);
if (!success) llSay(PUBLIC_CHANNEL, "Scaling failed!");
}
}
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlScaleByFactor, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.