PRIM MATERIAL/de

From Second Life Wiki
< PRIM MATERIAL
Revision as of 11:06, 30 November 2008 by Zai Lynch (talk | contribs) (l10n)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Beschreibung

Konstante: integer PRIM_MATERIAL = 2;
Video Tutorium über Materialien

<videoflash>6OXYO61kQCA</videoflash>

Die integer Konstante PRIM_MATERIAL hat den Wert 2

Setzt oder bezieht das Material eines Prims. Die Wahl des Materials hat keinen Effekt auf die Masse, wirkt sich allerdings auf Reibung, Elastizität und das Kollisionsgeräusch aus. Ein hölzernes Gefälle von 33° gibt für das unten angegebene Beispielscript die folgenden Resultate:

Tabelle stellt Maximalgeschwindigkeit und zurückgelegte Distanz beim herunterrollen des Gefälles dar.
Type Velocity (m/s) Distance (m)
Stein 0.453181 0.361655
Metall 5.475444 10.211180
Glas 6.483150 11.678304
Holz 2.154549 9.433724
Fleisch 0.351543 0.188043
Plastik 4.502428 9.590952
Gummi 0.374964 0.187106

llSetPrimitiveParams

[ PRIM_MATERIAL, integer Material ]
• integer Material PRIM_MATERIAL_* flag

Wenn mit llSetPrimitiveParams & llSetLinkPrimitiveParams genutzt

llGetPrimitiveParams

llGetPrimitiveParams([ PRIM_MATERIAL ]);

Gibt die Liste [ integer Material ]

• integer Material PRIM_MATERIAL_* flag

Ähnliche Artikel

Konstanten

Material Flags Beschreibung
PRIM_MATERIAL_STONE 0 Stein
PRIM_MATERIAL_METAL 1 Metall
PRIM_MATERIAL_GLASS 2 Glas
PRIM_MATERIAL_WOOD 3 Holz
PRIM_MATERIAL_FLESH 4 Fleisch
PRIM_MATERIAL_PLASTIC 5 Plastik
PRIM_MATERIAL_RUBBER 6 Gummi
PRIM_MATERIAL_LIGHT 7 Licht, VERALTET: Sieht genauso aus, wie [ PRIM_FULLBRIGHT, ALL_SIDES, TRUE ]

Funktionen

•  llSetPrimitiveParams Setzt die Parameter eines Prims
•  llSetLinkPrimitiveParams Setzt die Parameter eines gelinkten Prims
•  llGetPrimitiveParams Bezieht Parameter eines Prims

Ereignisse

•  changed Wird bei einer Änderung ausgelößt

Beispiele

<lsl>// © 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);
       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();
       }
   }

}</lsl>

Deep Notes

Nach JIRA-Issues suchen, die sich hierauf beziehen

Signature

integer PRIM_MATERIAL = 2;