Replaces deprecated llSetLinkPrimitiveParams, llSetPrimitiveParams.
llSetLinkPrimitiveParamsFast(integer link,// Link number (1 for root, >1 for children) or a LINK_* flag. Values: Linkslist rules// A list of PRIM_* rules and data to apply.
);- Energy
- 10
This is a very powerful & sharp function. Each PRIM_* rule takes at least one parameter and has its own quirks and its own dedicated article with specific information.
Sets the prims parameters according to rules.
llSetLinkPrimitiveParamsFast(0, []);Specification
Section titled “Specification”// Link targetingPRIM_LINK_TARGET, integer link_target // the rules after it apply to this link// Position and orientationPRIM_POSITION, vector position // region coordinatesPRIM_ROTATION, rotation rot // global rotation, like llSetRot; broken for child primsPRIM_SIZE, vector size // like llSetScale; fails silently on physical primsPRIM_POS_LOCAL, vector position // relative to the root, like llSetPos in a childPRIM_ROT_LOCAL, rotation rot // relative to the root, like llSetLocalRotPRIM_OMEGA, vector axis, float spinrate, float gain // client-side spin, like llTargetOmega; spinrate in radians per second// AppearancePRIM_COLOR, integer face, vector color, float alpha // Blinn-Phong colour and opacity; face may be ALL_SIDESPRIM_ALPHA_MODE, integer face, integer alpha_mode, integer alpha_cutoff // PRIM_ALPHA_MODE_*; alpha_cutoff used only for _MASKPRIM_TEXTURE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians // Blinn-Phong diffuse texturePRIM_FULLBRIGHT, integer face, integer boolean // full-bright rendering on the facePRIM_GLOW, integer face, float intensity // glow intensity on the facePRIM_POINT_LIGHT, integer boolean, vector linear_color, float intensity, float radius, float falloff // local light; linear_color in linear space (llsRGB2Linear)PRIM_BUMP_SHINY, integer face, integer shiny, integer bump // PRIM_SHINY_*, PRIM_BUMP_*PRIM_TEXGEN, integer face, integer mode // PRIM_TEXGEN_* texture mapping modePRIM_RENDER_MATERIAL, integer face, string render_material // clears most PRIM_GLTF_* overridesPRIM_GLTF_BASE_COLOR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector linear_color, float alpha, integer gltf_alpha_mode, float alpha_mask_cutoff, integer double_sided // linear_color: linear spacePRIM_GLTF_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians // glTF normal map overridePRIM_GLTF_METALLIC_ROUGHNESS, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, float metallic_factor, float roughness_factorPRIM_GLTF_EMISSIVE, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector linear_emissive_tint // linear spacePRIM_NORMAL, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians // Blinn-Phong normal mapPRIM_SPECULAR, integer face, string texture, vector repeats, vector offsets, float rotation_in_radians, vector color, integer glossiness, integer environment // Blinn-PhongPRIM_PROJECTOR, string texture, float fov, float focus, float ambiance // light projection; set onlyPRIM_REFLECTION_PROBE, integer boolean, float ambiance, float clip_distance, integer flags // custom reflection probe; PRIM_REFLECTION_PROBE_* flags// Text and namingPRIM_TEXT, string text, vector color, float alpha // floating text, like llSetTextPRIM_NAME, string name // like llSetObjectNamePRIM_DESC, string description // like llSetObjectDesc// ShapePRIM_TYPE, PRIM_TYPE_BOX, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shear // no effect on meshPRIM_TYPE, PRIM_TYPE_CYLINDER, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shearPRIM_TYPE, PRIM_TYPE_PRISM, integer hole_shape, vector cut, float hollow, vector twist, vector top_size, vector top_shearPRIM_TYPE, PRIM_TYPE_SPHERE, integer hole_shape, vector cut, float hollow, vector twist, vector dimplePRIM_TYPE, PRIM_TYPE_TORUS, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_TUBE, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_RING, integer hole_shape, vector cut, float hollow, vector twist, vector hole_size, vector top_shear, vector advanced_cut, vector taper, float revolutions, float radius_offset, float skewPRIM_TYPE, PRIM_TYPE_SCULPT, string map, integer typePRIM_SLICE, vector slice // shape slice, equivalent to cut / advanced_cut// Physics and behaviourPRIM_PHYSICS, integer boolean // whole object responds to physicsPRIM_PHANTOM, integer boolean // whole object phantomPRIM_TEMP_ON_REZ, integer boolean // whole object temporary; cleaned up in about a minutePRIM_PHYSICS_SHAPE_TYPE, integer type // PRIM_PHYSICS_SHAPE_NONE, _PRIM or _CONVEXPRIM_MATERIAL, integer material // PRIM_MATERIAL_*: default collision sound, friction, restitutionPRIM_FLEXIBLE, integer boolean, integer softness, float gravity, float friction, float wind, float tension, vector force // softness 0 to 3; gravity -10.0 to 10.0PRIM_COLLISION_SOUND, string sound, float volume // collision sound UUID and volumePRIM_DAMAGE, float damage, integer damage_type // damage delivered on collisionPRIM_HEALTH, float health // objects default to 0 health// Clicking and sittingPRIM_CLICK_ACTION, integer action // CLICK_ACTION_* default click/touch actionPRIM_SIT_TARGET, integer boolean, vector offset, rotation rot // FALSE removes it; offset may be ZERO_VECTORPRIM_SIT_FLAGS, integer flags // SIT_FLAG_*PRIM_SCRIPTED_SIT_ONLY, integer boolean // only llSitOnLink can seat avatarsPRIM_ALLOW_UNSIT, integer boolean // manual standing; experience seats (llSitOnLink) only
| Rule | Description |
|---|---|
PRIM_TYPE, integer flag, … | Sets the prim’s shape. The PRIM_TYPE_* flag picks the shape and the arguments that follow it. hole_shape is one of PRIM_HOLE_*; a sculpt’s type is one of PRIM_SCULPT_TYPE_*, optionally combined with PRIM_SCULPT_FLAG_*. Has no effect on mesh. Forms:
|
Shared wiki article
Section titled “Shared wiki article”This page transcludes LlSetPrimitiveParams. The following text is from that archived revision.
Caveats
Section titled “Caveats”PRIM_SIZEhas similar constraints tollSetScaleand fails silently on physical prims/links. One workaround is to set items to non-physical before changing their size, then changing them back to physical; this can be accomplished in a singlellSetLinkPrimitiveParamsFastcommand usingPRIM_LINK_TARGET.PRIM_PHANTOM,PRIM_PHYSICSandPRIM_TEMP_ON_REZapplies to the entire object (linkset).- Values may drift, become truncated or be range-limited. Some limits are applied by the client during deserialization and before rendering, others are applied by the simulator before storing the values.
- When testing vectors and rotations use
llVecDistandllAngleBetween(respectively) to perform fuzzy tests. PRIM_LINK_TARGETis a special parameter which can be inserted to perform actions on multiple prims on the linkset with one call.- Scripts written before September 2004 that use
PRIM_TYPEdepend onPRIM_TYPEto have the value 1; if these scripts are recompiled, the new value ofPRIM_TYPEwill be used, causing errors at runtime. - To fix this, replace the
PRIM_TYPEflag with the value 1 or update to the newerPRIM_TYPEsyntax. PRIM_ROTATIONis bugged in child prims. See Useful Snippets for a workaround, or the linked SVC-93 issue below.- This function will return an error if given data of the wrong type. This is problematic when providing data from user input or notecard. To remedy this, see List Cast function.
- Applying an operation to
LINK_SETwill apply it first to the root prim, then to each child prim. - The sim will clamp attributes before storing them.
- The client will clamp attributes before rendering.
- Some prim properties are reset by this function
- A flexible prim will become not flexible
- A sliced prim will become unsliced
- : In order to preserve properties they must be saved and explicitly set in the function call
- Attempting to change
PRIM_TYPEof a mesh object has no effect. - Keeping the
PRIM_TYPEasPRIM_TYPE_SCULPTand trying to set a different sculpt map or sculpt flags on a mesh also does nothing. Additionally, a script residing inside a mesh type prim cannot change the sculpt parameters of any prim in the linkset. - The caveats described at llSetClickAction all apply to
PRIM_CLICK_ACTION.
Examples
Section titled “Examples”A simple script to light up a prim in a linkset when touched, and unlight the others using llSetLinkPrimitiveParams, when script is installed in the root prim of the linkset.
// Turn all prims off and the one touched turn on
default{ touch_start(integer num_detected) { llSetLinkPrimitiveParamsFast(LINK_SET, [ PRIM_FULLBRIGHT, ALL_SIDES, FALSE, PRIM_LINK_TARGET, llDetectedLinkNumber(0), PRIM_FULLBRIGHT, ALL_SIDES, TRUE]); }}A simple script which moves all child prims .25m forward on the root’s Z axis, when touched.
27 collapsed lines
default{ touch_start(integer total_number) { integer numberOfPrims = llGetNumberOfPrims();
if (numberOfPrims < 2) return;
vector link_pos; list params;
integer link = 2;// start with first child prim do {// get a child prim's local position (i.e, relative to the root prim) link_pos = llList2Vector(llGetLinkPrimitiveParams(link, [PRIM_POS_LOCAL]), 0);
link_pos.z += 0.25;// relative to root's local z-axis !!!
params += [PRIM_LINK_TARGET, link, PRIM_POS_LOCAL, link_pos]; } while (++link <= numberOfPrims);
if (!llGetListLength(params)) return;
// the params list starts with a PRIM_LINK_TARGET (a hack so we can start// with the first child prim), so it doesn't really matter which number you// put as first parameter in this function call llSetLinkPrimitiveParamsFast(2, params); }}Example 3
Preferred method using PRIM_LINK_TARGET | Second method does the same effect-wise. |
|---|---|
| |
| Combining function calls |
|---|
|
|
// And if you want to place it above your bed, to make you sleep well, and the coords// of that place are, for example, <x, y, z>llSetPrimitiveParams([ PRIM_COLOR, ALL_SIDES, ZERO_VECTOR, 1.0, PRIM_COLOR, 3, <1.0,1.0,1.0>, 1.0, PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR,0.0, PRIM_FULLBRIGHT, 3, TRUE, PRIM_POSITION, <x, y, z>]);
// You can set the texture of several sides at once, with no time penalty,// just by repeating the param for that:llSetPrimitiveParams([ PRIM_TEXTURE, 3, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0, PRIM_TEXTURE, 4, "4d304955-2b01-c6c6-f545-c1ae1e618288", <1.0, 1.0, 0.0>, ZERO_VECTOR, 0.0]);Example 4
Top-size (taper)
Section titled “Top-size (taper)”default{ state_entry() { vector scale = llGetScale(); float X = scale.x; float Y = scale.y;
llSetPrimitiveParams([ PRIM_SIZE, <X, Y, 0.1>, // keep the prim thin PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <1.0 - (0.4 / X), 1.0 - (0.4 / Y), 0.0>, ZERO_VECTOR]); // We used the equation "answer = 1 - desired_taper"
// The proportions of the top-size (taper) will be maintained (as close as possible) // whenever the prim is resized. The proportion above will produce a reasonably // pleasing picture frame kinda thing. }
changed(integer change) { if(change & CHANGED_SCALE) { llResetScript(); } }}Helper functions
Section titled “Helper functions”//-- PRIM_ROTATION workaround for child prims (works in unattached objects only)llSetLinkPrimitiveParamsFast(linknumber, [ PRIM_ROT_LOCAL, rot*llGetRootRotation()]);
//-- PRIM_ROTATION workaround for child prims (works in linked objects only)llSetLinkPrimitiveParamsFast(linknumber, [ PRIM_ROT_LOCAL, rot*llList2Rot(llGetLinkPrimitiveParams(LINK_ROOT, [PRIM_ROT_LOCAL]), 0)]);
//-- PRIM_ROTATION workaround for child prims (works in all scenarios)llSetLinkPrimitiveParamsFast(linknumber, [ PRIM_ROT_LOCAL, rot*llList2Rot(llGetLinkPrimitiveParams(!!llGetLinkNumber(), [PRIM_ROT_LOCAL]), 0)]);The old PRIM_TYPE interface (labeled PRIM_TYPE_LEGACY), while technically retired, can still be used.
{{#var:PRIM_POSITION/SLPP&A}}
History
Section titled “History”- Date of release llSetLinkPrimitiveParams 21-02-2007 or 14-03-2007
- Date of release
llSetLinkPrimitiveParamsFast29-03-2010
Known issues
Section titled “Known issues”From the issue templates included by the wiki article:
- SVC-2105 (nf): '''llSetLinkListPrimitiveParams'''() for setting multiple, specific linked items
See also
Section titled “See also”Functions
Section titled “Functions”llGetPrimitiveParams— Get many primitive parametersllGetLinkPrimitiveParams— Get many primitive parameters of other prims in liksetllSetLinkPrimitiveParamsFast— Set parameters on other prims in linkset without sleepllSetAlpha— Simpler way to set alpha (transparency) without (re-)setting color.llSetTexture— Simpler way to set texturellSetColor— Simpler way to set colorllSetScale— Simpler way to set scalellSetStatus— Simpler way to set physics and phantomllSetLinkGLTFOverrides— Set or remove individual glTF material overrides on a face
Articles
Section titled “Articles”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.