Rang: Ehrenmitglied
Mitglied seit: 05.09.2014(UTC) Beiträge: 84  Wohnort: Tulln und Rostock Dankte: 1 mal(e)
|
llSetTextureAnim hat eine nervige Einschränkung: es funktioniert nur entlang der X-Achse. Möchte man etwas um 90° gedreht animieren, bleibt einem oft nur, die Rotation der Fläche um 90° zu drehen, und entsprechend eine neue Textur hochzuladen (ebenfalls um 90° gedreht). Wenn man die Möglichkeit dazu nicht hat, zum Beispiel weil man keine Fullperm-Textur besitzt, kann man das untenstehende Skript verwenden, statt der Funktion llSetTextureAnim. Wenn man nun iANIMATE_X auf FALSE setzt, wird die Textur entlang der Y-Achse bewegt (in dem Beispiel bei einem Würfel etwa von unten nach oben). Code:
float fSleep = 0.02; //speed
string sTexture = "5baee477-ea6d-bd2e-c213-c99a4393796f"; //put texture key here
integer iLink = LINK_THIS; //linknumber
integer iFace = ALL_SIDES; //linkface
float fRotation = 0.0; //texture rotation
vector vRepeats = <1.0, 1.0, 0.0>; //repeats
integer iANIMATE_X = TRUE; //set this to TRUE or FALSE, if you want to animate along the X-axis or the Y axis, according.
integer iDIRECTION_POSITIVE = FALSE; //set this to TRUE or FALSE if you want to swap directions from negative to positive animation-direction, according.
float fStepwidth = 0.01; //jump per animation-frame
float fStep = 0.0; //global variable, don't change
setTextureAnim(string stexture, integer ilink, integer iface, float frotation, vector vrepeats, integer animatex, integer directionpositive, float fstepwidth)
{
vector vOffset = <fStep, 0.0, 0.0>;
if (animatex == FALSE)
{
vOffset = <0.0, fStep, 0.0>;
}
llSetLinkPrimitiveParamsFast(ilink, [ PRIM_TEXTURE, iface, stexture, vrepeats, vOffset, frotation]);
if (directionpositive)
{
fStep = fStep + fstepwidth;
if (fStep > 1.0)
{
fStep = 0.0;
}
}
else
{
fStep = fStep - fstepwidth;
if (fStep < 0.0)
{
fStep = 1.0;
}
}
}
default
{
state_entry()
{
llSetTimerEvent(fSleep);
}
timer()
{
setTextureAnim(sTexture, iLink, iFace, fRotation, vRepeats, iANIMATE_X, iDIRECTION_POSITIVE, fStepwidth);
}
}
|
It is the mark of an educated mind to be able to entertain a thought without accepting it. |