Jump to content

What would I have to change in this script


0og
 Share

You are about to reply to a thread that has been inactive for 3976 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

to make the texture appear as thouigh it's going around in a circle on the flat face of a cyclinder instead of it appearing as though it is going across the face of the prim? Like the spokes of a bicycle would be turning.

 


default
{
    // state_entry() is an event handler, it executes
    // whenever a state is entered.
    state_entry()
    {  
        // llSetTextureAnim() is a function that animates a texture on a face.
        llSetTextureAnim(ANIM_ON | SMOOTH | LOOP, ALL_SIDES,1,1,1.0, 1,0.25);
                            // animate the script to scroll across all the faces.
    }
 
   
}

Link to comment
Share on other sites

float rotate;

default
{
    state_entry()
    {
        rotate = 0;
        llSetTimerEvent(.1);
        
    }

   timer()
   {
       rotate = rotate + .1;
       if (rotate==10.1)
       {
           rotate = 0;
           
        }
        llRotateTexture(rotate,ALL_SIDES);//You will have to set this to what face you want
     }
}

Link to comment
Share on other sites

this will give you a variable called "speed", which you can change

if you need to....

to rotate in the oposite direction, change the end part to ...speed*-TWO_PI

 

default{    state_entry()    {         float speed = 0.05;        llSetTextureAnim(ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES,1,1,0, TWO_PI, speed*TWO_PI);    }}

 

Link to comment
Share on other sites

Xiija's is the preferred option - texture animation not taking anything like as much sim resource as object rotation.

However, if I remember correctly, the flat faces of cylinders are not good surfaces for textures and you may get odd effects :-(  If it works for you, great, otherwise you'll have to go with Steph's answer of rotation the whole object.

Link to comment
Share on other sites

I'd go for Xiija's method, too -- in fact, I was writing an example but she beat me to it.   I'd not heard that the flat faces of cylinders are glitchy for this, not that I do much with animated textures.

You might also consider actually spinning the prims, like this (it's how I sometimes do it):

integer toggle;list wheels;list findPrimsByDescription(string desc){//link description field	list l;	integer max = llGetObjectPrimCount(llGetKey());	string str;	if (desc){		desc = llToLower(desc);		do {			str = llToLower(llStringTrim(llList2String(llGetLinkPrimitiveParams(max,[PRIM_DESC]),0),STRING_TRIM));//read the link description of each prim			if (str == desc){//if it's what we're looking for				l+=[max]; // make a note of the link number			}		}		while (--max);	}	return l;}default{	state_entry()	{		wheels = findPrimsByDescription("wheel"); // look for prims with "wheel" was their description		llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_OMEGA,<0.0,0.0,0.0>,0.0,0.1]);	}	on_rez(integer start_param)	{		wheels = findPrimsByDescription("wheel"); // look for prims with "wheel" was their description		llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_OMEGA,<0.0,0.0,0.0>,0.0,0.1]);	}	changed(integer change)	{		if (change & CHANGED_LINK){			wheels = findPrimsByDescription("wheel"); // look for prims with "wheel" was their description			llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_OMEGA,<0.0,0.0,0.0>,0.0,0.1]);		}	}	touch_start(integer total_number)	{		toggle = !toggle;		if (toggle){			list params;			integer n = -llGetListLength(wheels);			rotation local;			if(n){				do {					integer int = llList2Integer(wheels,n);					local = llList2Rot(llGetLinkPrimitiveParams(int,[PRIM_ROT_LOCAL]),0);					params +=[PRIM_LINK_TARGET,int,PRIM_OMEGA,<0.0,0.0,1.0>*local,1.0,0.1]; // assumes the wheels are cylinders, turned through 90 degrees				}				while (++n);			}			llSetLinkPrimitiveParamsFast(LINK_SET,params);		}		else{			llSetLinkPrimitiveParamsFast(LINK_SET,[PRIM_OMEGA,<0.0,0.0,0.0>,0.0,0.1]);		}	}}

 

.  I once thought that using llTargetOmega for physical prims was discouraged, by the way, since the rotations are done server side rather than client side, but I am pretty sure I remember Void explaining once that child prims using TARGET_OMEGA are always rotated by the client, not the sim, no matter whether they're physical or not.

Link to comment
Share on other sites

Textures rotating on cylinder faces can have a strange juddering effect, why i have no idea and i have never found anyone who knew either. Personaly id rarther not use my example but i got irrited by the other functions erratic behaviour. LL may have resolved it and the function works fine now. If the anyone could let me know i be happy to use it.

Added: Ijust tried it and it has not changed, it still erratic.

Link to comment
Share on other sites

I don't know if this is the cause of the juddering problem, but certainly I've found I can make textures rotate a lot more smoothly if I do it this way:

 

		integer sizeX =1;//ignored for ROTATE		integer sizeY =1; //ignored for ROTATE		float startRotate = 0.0;//angle IN RADIANS at which to start the rotation		float endRotate = TWO_PI; //angle IN RADIANS at which to end the rotation		float framesPerSecond = 0.5*TWO_PI; //nb multiplication by TWO_PI		llSetTextureAnim(ANIM_ON | SMOOTH | ROTATE | LOOP, ALL_SIDES,sizeX,sizeY,startRotate, endRotate, framesPerSecond);

 That way, the rotation is a full 360 degrees, and it's rotating by clear percentage of the full rotation every second.   I think it's when the rotation isn't ending at 360 (TWO_PI) that the trouble starts, because it's got to jump from the end position to the start each time.

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 3976 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...