PRIM_MATERIAL
constant
Constant
integer PRIM_MATERIAL = 2;Constant groups
Other PrimParam values (42)
PRIM_ALLOW_UNSIT39PRIM_ALPHA_MODE38PRIM_BUMP_SHINY19PRIM_CLICK_ACTION43PRIM_COLLISION_SOUND53PRIM_COLOR18PRIM_DAMAGE51PRIM_DESC28PRIM_FLEXIBLE21PRIM_FULLBRIGHT20PRIM_GLOW25PRIM_GLTF_BASE_COLOR48PRIM_GLTF_EMISSIVE46PRIM_GLTF_METALLIC_ROUGHNESS47PRIM_GLTF_NORMAL45PRIM_HEALTH52PRIM_LINK_TARGET34PRIM_NAME27PRIM_NORMAL37PRIM_OMEGA32PRIM_PHANTOM5PRIM_PHYSICS3PRIM_PHYSICS_SHAPE_TYPE30PRIM_POINT_LIGHT23PRIM_POS_LOCAL33PRIM_POSITION6PRIM_PROJECTOR42PRIM_REFLECTION_PROBE44PRIM_RENDER_MATERIAL49PRIM_ROT_LOCAL29PRIM_ROTATION8PRIM_SCRIPTED_SIT_ONLY40PRIM_SIT_FLAGS50PRIM_SIT_TARGET41PRIM_SIZE7PRIM_SLICE35PRIM_SPECULAR36PRIM_TEMP_ON_REZ4PRIM_TEXGEN22PRIM_TEXT26PRIM_TEXTURE17PRIM_TYPE9
Other PrimParamGet values (40)
PRIM_ALLOW_UNSIT39PRIM_ALPHA_MODE38PRIM_BUMP_SHINY19PRIM_CLICK_ACTION43PRIM_COLLISION_SOUND53PRIM_COLOR18PRIM_DAMAGE51PRIM_DESC28PRIM_FLEXIBLE21PRIM_FULLBRIGHT20PRIM_GLOW25PRIM_GLTF_BASE_COLOR48PRIM_GLTF_EMISSIVE46PRIM_GLTF_METALLIC_ROUGHNESS47PRIM_GLTF_NORMAL45PRIM_HEALTH52PRIM_NAME27PRIM_NORMAL37PRIM_OMEGA32PRIM_PHANTOM5PRIM_PHYSICS3PRIM_PHYSICS_SHAPE_TYPE30PRIM_POINT_LIGHT23PRIM_POS_LOCAL33PRIM_POSITION6PRIM_REFLECTION_PROBE44PRIM_RENDER_MATERIAL49PRIM_ROT_LOCAL29PRIM_ROTATION8PRIM_SCRIPTED_SIT_ONLY40PRIM_SIT_FLAGS50PRIM_SIT_TARGET41PRIM_SIZE7PRIM_SLICE35PRIM_SPECULAR36PRIM_TEMP_ON_REZ4PRIM_TEXGEN22PRIM_TEXT26PRIM_TEXTURE17PRIM_TYPE9
Sets the prim material. Material does not affect mass, but does affect friction, bounce (elasticity), and collision sound. On a wood incline of 33 degrees, the example script below gave the following results:
Table detailing maximum velocity and distance traveled down the incline.
| Type | Velocity (m/s) | Distance (m) |
|---|---|---|
Stone | 0.453181 | 0.361655 |
Metal | 5.475444 | 10.211180 |
Glass | 6.483150 | 11.678304 |
Wood | 2.154549 | 9.433724 |
Flesh | 0.351543 | 0.188043 |
Plastic | 4.502428 | 9.590952 |
Rubber | 0.374964 | 0.187106 |
Examples
Section titled “Examples”Example 1
56 collapsed lines
// © 2008 by Karzita Zabaleta// Author of Scripting Your World, Wiley, October 2008.
list gMaterialTypes = [ "STONE", "METAL", "GLASS", "WOOD", "FLESH", "PLASTIC", "RUBBER"];
vector gHomePosition;rotation gHomeRotation;integer gWaitCount = 0;float gMaxVelMag;integer gPrimMaterial;
moveTo(vector origin, vector destination) { float dist = llVecDist(origin, destination); integer passes = llCeil( llLog(dist/10.0) / llLog(2.0) ); integer i; list params = [PRIM_POSITION, destination]; for (i=0; i<passes; i++) { params = (params=[]) + params + params; } // actually move the prim, now llSetPrimitiveParams(params);}
returnHome(){ llSetStatus(STATUS_PHYSICS, FALSE); moveTo(llGetPos(),gHomePosition); llSetTimerEvent(0); llSetRot(gHomeRotation);}
calculate_velocity(){ float velMag = llVecMag(llGetVel()); if (velMag > gMaxVelMag) { gMaxVelMag = velMag; }}
default{ state_entry() { gHomePosition = llGetPos(); gHomeRotation = llGetRot(); } on_rez(integer _n) { llResetScript(); } touch_start(integer n) { gMaxVelMag = 0; llSetPrimitiveParams([PRIM_MATERIAL, gPrimMaterial]); llSetStatus(STATUS_PHYSICS,TRUE); llSetTimerEvent(0.1);16 collapsed lines
llResetTime(); gWaitCount=0; gPrimMaterial++; if (gPrimMaterial == 7 ) gPrimMaterial = 0; } timer() { calculate_velocity(); gWaitCount++; if (gWaitCount > 100) { // 10 seconds string type = llList2String( gMaterialTypes, gPrimMaterial-1 ); llOwnerSay(type+" reached maximum velocity of "+(string)gMaxVelMag+ " and traveled "+(string)llVecDist(llGetPos(), gHomePosition)+" meters."); returnHome(); } }}See also
Section titled “See also”Constants
Section titled “Constants”|
| Constant | Type | Value | Description |
|---|---|---|---|
PRIM_MATERIAL_STONE | integer | 0 | stone |
PRIM_MATERIAL_METAL | integer | 1 | metal |
PRIM_MATERIAL_GLASS | integer | 2 | glass |
PRIM_MATERIAL_WOOD | integer | 3 | wood |
PRIM_MATERIAL_FLESH | integer | 4 | flesh |
PRIM_MATERIAL_PLASTIC | integer | 5 | plastic |
PRIM_MATERIAL_RUBBER | integer | 6 | rubber |
| PRIM_MATERIAL_LIGHT | integer | 7 | light, DEPRECATED: Looks the same as [ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ] |
material Flags | Description | Friction | Restitution | ||||
|---|---|---|---|---|---|---|---|
| 0.8 | 0.4 | ||||||
| 0.3 | 0.4 | ||||||
| 0.2 | 0.7 | ||||||
| 0.6 | 0.5 | ||||||
| 0.9 | 0.3 | ||||||
| 0.4 | 0.7 | ||||||
| 0.9 | 0.9 | ||||||
light, DEPRECATED: Looks the same as [ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ] | 0.6 | 0.5 | |||||
Functions
Section titled “Functions”Events
Section titled “Events”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.