Jump to content
Sign in to follow this  
RhaDo2496

how to move texture on a face by a script

Recommended Posts

hi i made some texture for a hud and now i need to move it by script for some buttons to switch between the on/off textrue on the same texture

Share this post


Link to post
Share on other sites

You could use llGetLinkPrimitiveParams and llSetLinkLinkPrimitiveParams, in each case using the PRIM_TEXTURE parameter. Note, however, that NULL_KEY is returned when the owner does not have full permissions to the object and the texture is not in the prim's inventory. Since that's the case, and since you made the texture yourself, it would be much easier to simply hard code the texture's UUID into your script and apply it  directly.

Share this post


Link to post
Share on other sites

Afraid not. It can be a trivially small script, though, just handling the link_message() event sent from a master script in root. I know it's not super efficient to do it this way, but when the "efficient script" functions were introduced, they cut some corners, including the oft-requested abiliity to specify individual parameters.

(There's a totally impractical way to leave the script out of the link most of the time, by pushing it only when needed using llRemoteLoadScriptPin(), but that's crazy slow and resource intensive, and totally not a thing to do here.)


... and ETA. I should have known better than to say something isn't possible. No sooner had I posted than I remembered a trick I used once upon a time to "fake" texture offset with texture anim (back when there were bugs in offsets to normal- and specular-maps), which could be done with llSetLinkTextureAnim() from a remote root script. In this little demo, the state_entry specifies a (Mole's) texture UUID just to set up the prim for demonstration, but the texture offset stuff happens in touch_start without referencing that UUID.

integer NUMBER_FACE = 0;integer NUMBER_LINK = LINK_THIS;string NUMBER_TEXTURE = "f16e2a6b-39b7-a4c9-0904-7b5ef84b56ad";integer COLUMNS = 4;integer ROWS = 4;integer numberShowing;default{    state_entry()    {        // Set texture section showing by default        // This first is optional to get around an old viewer bug that may be obsolete        llSetLinkPrimitiveParamsFast(NUMBER_LINK,            [ PRIM_TEXTURE, NUMBER_FACE, NUMBER_TEXTURE            , <1.0/COLUMNS, 1.0/ROWS, 0.0>    // repeats            , <(1-COLUMNS)*(0.5/COLUMNS), (ROWS-1)*(0.5/ROWS), 0.0>    // offsets            , 0.0   // rotation in radians            ]);        llSetTextureAnim(FALSE, NUMBER_FACE, COLUMNS, ROWS,            0.0, 0.0, 0.0);    }    on_rez(integer start_param)    {        llResetScript();    }    touch_start(integer total_number)    {        numberShowing = ++numberShowing % (ROWS*COLUMNS);        llSetTextureAnim(ANIM_ON, NUMBER_FACE, COLUMNS, ROWS,            (float)numberShowing, 0.0, 0.0);    }}
  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...