Difference between revisions of "LlScaleByFactor"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{LSL_Function|mode=request
{{LSL_Function|mode=request
|inject-2=
|inject-2=
|func_id=|func_sleep=0.0|func_energy=
|func_id=|func_sleep=0.0|func_energy=10.0
|func=llScaleByFactor|sort=ScaleByFactor
|func=llScaleByFactor|sort=ScaleByFactor
|return_type=float
|return_type=integer
|p1_type=float|p1_name=scaling_factor|p1_desc=The multiplier to be used with the prim sizes and their local positions.
|p1_type=float|p1_name=scaling_factor|p1_desc=The multiplier to be used with the prim sizes and their local positions.
|func_desc=Attempts to resize the entire object by {{LSLP|scaling_factor}}, maintaining the size-position ratios of the prims.
|func_desc=Attempts to resize the entire object by {{LSLP|scaling_factor}}, maintaining the size-position ratios of the prims.
Line 11: Line 11:
|spec
|spec
|caveats
|caveats
* Rescaling fails if the linkset is physical, a pathfinding character, in a keyframed motion, or if rescaling would cause the parcel to overflow.
* Due to floating point precision issues (because 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).
|constants
|constants
|examples
|examples

Revision as of 15:44, 6 January 2014

Emblem-important-yellow.png LSL Feature Request
The described function does not exist. This article is a feature request.

Summary

Function: integer llScaleByFactor( float scaling_factor );
REQUEST Function ID
0.0 Forced Delay
10.0 Energy

Attempts to resize the entire object by scaling_factor, maintaining the size-position ratios of the prims.
Returns a boolean (an integer) TRUE if it succeeds, FALSE if it fails.

• float scaling_factor The multiplier to be used with the prim sizes and their local positions.

Examples

See Also

Deep Notes

This function is roughly equivalent to the following: <lsl> float VectorAbsStatistics(integer flag, vector a){

   return llListStatistics(flag, [llFabs(a.x), llFabs(a.y), llFabs(a.z)]);

}

integer ScaleByFactor(float scale) {

   vector root = llGetScale() * scale;
   if(VectorAbsStatistics(LIST_STAT_MAX, root) > 64

History

Search JIRA for related Issues

Signature

//function integer llScaleByFactor( float scaling_factor );