LSL Wiki Mirror 10-5-2006: llSetPrimitiveParams

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings ::
llSetPrimitiveParams(list rule)

This function allows a script to change the many properties (or "parameters") of a prim simultaneously. (Remember, don't confuse prim "parameters" with function parameters.)

The list is executed/parsed one element at a time, allowing such useful things as WarpPos to exist.

It takes a list as an argument, much as llParticleSystem does. The list always starts with a constant determining the type of change, followed by one or more parameters. For example:

llSetPrimitiveParams([PRIM_SIZE, <1, 1, 1>]); //sets the size of the prim to 1x1x1

There are many constants that can be used. See the following tables.

Notes
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, 
     <0, 0, 0>, 1.0, PRIM_COLOR, 0, <0, 1, 0>, 1.0]);
...will turn all sides except face 0 black (<0, 0, 0>); face 0 will turn green (<0, 1, 0>).
llSetPrimitiveParams([PRIM_COLOR, ALL_SIDES, <0, 0, 0>, 1.0,PRIM_PHANTOM, TRUE]);
...will turn all sides black (<0, 0, 0>); and set the object phantom

Rules (whenever the "Parameter(s)" column references a PRIM_xxx constant, it can be found in the tables below this one):
Constant Name Description
Alternative
Parameter(s) Example Rule Value
PRIM_BUMP_SHINY Sets bumpmapping and shininess of a face integer face, PRIM_SHINY_xxx, PRIM_BUMP_xxx [PRIM_BUMP_SHINY, 2, PRIM_SHINY_LOW, PRIM_BUMP_GRAVEL] 19
PRIM_COLOR Sets color and alpha of a face
llSetColor, llSetAlpha
integer face, vector color, float alpha [PRIM_COLOR, 1, <1, 0, 0>, 0.75] 18
PRIM_FLEXIBLE Toggles flexible property and attributes: softness, gravity, drag (friction), wind, tension, and force. boolean TRUE/FALSE, integer softness, float gravity, float friction, float wind, float tension, vector force [PRIM_FLEXIBLE, TRUE, 2, 0.3, 2.0, 0.0, 1.0, <0, 0, 0>] 21
PRIM_FULLBRIGHT Sets full bright of a face on or off. integer face, boolean on
on = TRUE/FALSE
[PRIM_FULLBRIGHT, ALL_SIDES, TRUE] 20
PRIM_MATERIAL Sets material of the prim PRIM_MATERIAL_xxx [PRIM_MATERIAL, PRIM_MATERIAL_RUBBER] 2
PRIM_PHANTOM Sets phantom property of an object
llSetStatus
TRUE/FALSE [PRIM_PHANTOM, TRUE] 5
PRIM_PHYSICS Sets physics property of an object
llSetStatus
TRUE/FALSE [PRIM_PHYSICS, TRUE] 3
PRIM_POINT_LIGHT Toggles light property and attributes: color, intensity, radius, and falloff. TRUE/FALSE, vector color, float intensity, float radius, float falloff [PRIM_POINT_LIGHT, TRUE, <1, 1, 1>, 1.0, 10.0, 0.75] 23
PRIM_POSITION Moves object to position.
This will silently fail for a child prim of a link set if the child prim exceeds the link distance! Also, as with llSetPos, will not move an object below ground; its center will be set at ground height.
llSetPos
vector position [PRIM_POSITION, <128, 128, 40>] 6
PRIM_ROTATION Sets the rotation of the object
llSetRot
rotation rot [PRIM_ROTATION, <0, 0, 0, 1>] 8
PRIM_SIZE Sets the scale of an object (Between <0.01,0.01,0.01> and <10,10,10>)
llSetScale
vector size [PRIM_SIZE, <4, 3, 0.1>] 7
PRIM_TEMP_ON_REZ Sets temporary on rez property of an object TRUE/FALSE [PRIM_TEMP_ON_REZ, TRUE] 4
PRIM_TYPE Sets the basic prim type; will unsit all avatars on object. See next table   9
PRIM_TEXGEN Sets the texture mapping mode, either PRIM_TEXGEN_DEFAULT or PRIM_TEXGEN_PLANAR. integer face, integer type [PRIM_TEXGEN, ALL_SIDES, PRIM_TEXGEN_DEFAULT] 22
PRIM_TEXTURE Sets the texture properties of a face
llSetTexture, llScaleTexture, llOffsetTexture, llRotateTexture
integer face, string name, vector repeats, vector offsets, float rotation
Note: name can be the name of a texture in the prim's contents or the key of a texture, but must be of type string.
[PRIM_TEXTURE, 0, "66864f3c-e095-d9c8-058d-d6575e6ed1b8", <2,8,0>, <.5,.5,0>, PI / 4] 17

Constants for PRIM_TYPE and their parameters (these are always preceded by the prefix PRIM_TYPE ):
Constant Name Value Type Parameter(s) Example rule
PRIM_TYPE_BOX 0 Box integer holeshape, vector cut, float hollow, vector twist, vector taper_b, vector topshear [PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]
PRIM_TYPE_CYLINDER 1 Cylinder integer holeshape, vector cut, float hollow, vector twist, vector taper_b, vector topshear [PRIM_TYPE, PRIM_TYPE_CYLINDER, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 1.0, 0.0>, <0.0, 0.0, 0.0>]
PRIM_TYPE_PRISM 2 Prism integer holeshape, vector cut, float hollow, vector twist, vector taper_b, vector topshear [PRIM_TYPE, PRIM_TYPE_PRISM, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>]
PRIM_TYPE_SPHERE 3 Sphere integer holeshape, vector cut, float hollow, vector twist, vector dimple [PRIM_TYPE, PRIM_TYPE_SPHERE, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>]
PRIM_TYPE_TORUS 4 Torus integer holeshape, vector cut, float hollow, vector twist, vector holesize, vector topshear, vector profilecut, vector taper_a, float revolutions, float radiusoffset, float skew [PRIM_TYPE, PRIM_TYPE_TORUS, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]
PRIM_TYPE_TUBE 5 Tube integer holeshape, vector cut, float hollow, vector twist, vector holesize, vector topshear, vector profilecut, vector taper_a, float revolutions, float radiusoffset, float skew [PRIM_TYPE, PRIM_TYPE_TUBE, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]
PRIM_TYPE_RING 6 Ring integer holeshape, vector cut, float hollow, vector twist, vector holesize, vector topshear, vector profilecut, vector taper_a, float revolutions, float radiusoffset, float skew [PRIM_TYPE, PRIM_TYPE_RING, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1.0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]

For access to the old PRIM_TYPE format, use 1 instead of PRIM_TYPE - BW

Notes on the above parameters:
Parameter Note
repeats x and y range from 0.0 to 100 (z is ignored)
offsets x and y range from -1 to 1 (z is ignored)
cut/dimple/profilecut x and y range from 0.0 to 1.0, x must be at least 0.05 smaller than y (z is ignored)
hollow ranges from 0.0 (solid) to 0.95 (maximum hollowed)
twist boxes, cylinders, prisms
ranges from -0.5 (-180 degree in the edit window) to 0.5 (+180 degree in the edit window) for both x and y (z is ignored)
spheres, tubes, torii, rings
ranges from -1.0 (-360 degree in the edit window) to 1.0 (+360 degree in the edit window) for both x and y (z is ignored)
holesize


taper_b
x ranges from 0.05 to 1.0
y ranges from 0.05 (large hole) to 0.50 (no hole)
ranges from 0.0 to 2.0 for both x and y (z is ignored)
topshear ranges from -0.5 to 0.5 for both x and y (z is ignored)
taper_a ranges from -1.0 to 1.0 for both x and y (z is ignored)
revolutions ranges from 1.0 to 4.00
radiusoffset depends on holesize y and revolutions
skew
See the restrictions table on the LibraryPrimTorture page; it looks more complete.

holeshape constants (for PRIM_TYPE parameters):
Constant Value Shape
PRIM_HOLE_DEFAULT 0 default (matches the prim type: square for box, circle for cylinder, etc.)
PRIM_HOLE_SQUARE 32 square
PRIM_HOLE_CIRCLE 16 circle
PRIM_HOLE_TRIANGLE 48 triangle

Bumpmapping constants (for PRIM_BUMP_SHINY):
Constant Value Description
PRIM_BUMP_NONE 0 none: no bump map
PRIM_BUMP_BRIGHT 1 brightness: generate bump map from highlights
PRIM_BUMP_DARK 2 darkness: generate bump map from lowlights
PRIM_BUMP_WOOD 3 woodgrain
PRIM_BUMP_BARK 4 bark
PRIM_BUMP_BRICKS 5 bricks
PRIM_BUMP_CHECKER 6 checker
PRIM_BUMP_CONCRETE 7 concrete
PRIM_BUMP_TILE 8 crustytile
PRIM_BUMP_STONE 9 cutstone: blocks
PRIM_BUMP_DISKS 10 discs: packed circles
PRIM_BUMP_GRAVEL 11 gravel
PRIM_BUMP_BLOBS 12 petridish: blobby amoebalike shapes
PRIM_BUMP_SIDING 13 siding
PRIM_BUMP_LARGETILE 14 stonetile
PRIM_BUMP_STUCCO 15 stucco
PRIM_BUMP_SUCTION 16 suction: rings
PRIM_BUMP_WEAVE 17 weave

Shininess constants (for PRIM_BUMP_SHINY):
Constant Value Description
PRIM_SHINY_NONE 0 none
PRIM_SHINY_LOW 1 low
PRIM_SHINY_MEDIUM 2 medium
PRIM_SHINY_HIGH 3 high

Material constants (for PRIM_MATERIAL):
Constant Value Description
PRIM_MATERIAL_STONE 0 stone
PRIM_MATERIAL_METAL 1 metal
PRIM_MATERIAL_GLASS 2 glass
PRIM_MATERIAL_WOOD 3 wood
PRIM_MATERIAL_FLESH 4 flesh
PRIM_MATERIAL_PLASTIC 5 plastic
PRIM_MATERIAL_RUBBER 6 rubber
PRIM_MATERIAL_LIGHT 7 light (deprecated in SL 1.9.1)

Q & A

Q: What happened to the topsize PRIM_TYPE parameter for boxes, cylinders, and prisms?
A: This was changed to taper in SL 1.10. It works exactly the same as topsize did for values from 0.0 to 1.0, but now it also accepts values from -1.0 to 0.0. Negative values shrink the bottom face instead of the top one. In this way, it is now analogous to the pre-existing taper parameter for torii, tubes, and rings.

Q: Is there any way to flip a texture within a script? You have x and y flip toggles in the edit dialog, but I can't find a way to do this from a function.
A: Yes. Use negative values in the repeats vector.

Q: With llSetPrimitiveParams, you can set almost everything about a prim that you can with llSetScale(), llSetColor(), llSetPos(), llSetRot(), etc. Will these be officially deprecated?
A: No. There are cases where the individual functions are still useful. For instance, they're significantly faster than llSetPrimitiveParams, both for scripters to write, and scripts to parse because they're simple variables and not a list, thus making them very practical for most simple manipulation of prims.

Q: Can I set a texture animation with llSetPrimitiveParams?
A: No. llSetTextureAnim remains the only way to do it.

Q: Does PRIM_POSITION use global, region, or local coordinates?
A: It works exactly like llSetPos, using region coordinates when it's the root prim and not an attachment. For child prims, or root attachments, it uses local coordinates.

Q: Is there any documentation for the old PRIM_TYPE format around anywhere?
A: Sort of, browse the revision history, anything before 8-31-2004 is before the change over; The old interface was lacking in many respects. I recommend using one of the LibraryPrimTorture encapsulation functions; they solve the problem of having to deal with the different number of paramaters required for each prim type.

Q: What is up with taper_a & taper_b?
A: Before SL 1.11 boxs, cylinders & prisms had an attribute called top_size, ranging from 0.0 (no top) to 1.0 (full top). In 1.11 they retrofitted the attribute so that it could adjust the size of the bottom of the prim aswell. For lack of a better name, they renamed the attribute to taper (taper_b). What they did not do was adjust the range to be the same as in the client, as that would break existing content (I suggested they create a new PRIM_TYPE flag like they had in the past; they did not). In the client they made the range -1.0 -> 1.0, while in scripting the range was to be 0.0 -> 2.0 (to convert do: 1.0 - value). To confuse things the old top_size attribute occupies the same address in the object description structure as hole_size. Since taper_a, taper_b have different ranges, occupy different address and co-exist, for sake of sanity and readabilty I have renamed them for this peice of documentation. I ment to fix the documentation earlier it just slipped my mind. -- BW

See also llGetPrimitiveParams.


Functions | Prim
There are 24 comments on this page. [Display comments/form]