Jump to content
Laurent Bechir

Script to make a moving mesh object

Recommended Posts

Hello

Where can I find a script to simulate a moving mesh object by switching a texture between its faces, each face being a step of the movement. I hope I'm clear ?

Thank you 

Share this post


Link to post
Share on other sites

When you write your script, I suggest using llSetLinkPrimitiveParamsFast in a timer event, scripted so that it cycles through the faces each time you trigger the timer, resetting all other faces to your default texture (TEXTURE_BLANK maybe).  So, for example, assuming that you have four faces numbered 0, 1, 2, and 3 and have defined a global integer counter ( iCount ) , you would have something that might look like:

timer()

    llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_TEXTURE, ALL_SIDES, TEXTURE_BLANK, <1,1,1>,ZERO_VECTOR, 0.0]);  // Sets all to default
    iCount = ++iCount%4;
    llSetLinkPrimitiveParamsFast(LINK_THIS, [ PRIM_TEXTURE, iCount, texture_UUID, <1,1,1>,ZERO_VECTOR, 0.0 ]);	// Sets target texture on face = iCount
}

 

Edited by Rolig Loon
  • Like 2

Share this post


Link to post
Share on other sites
1 hour ago, animats said:

For that, use llSetTextureAnim. Once started, any viewer passing by will run the animation smoothly without any server or LSL involvement.

No, not really...

What the op ASKED was how to toggle the textures on different faces of an object, to fake movement, this sort of thing is already pretty common in pre bento mesh tails for example, where the "Tail" is actually several different tails, each in a slightly different pose.

In that case llSetLinkPrimitiveParamsFast allows you to toggle the alpha on each of the 8 faces of each of the "8 faced mesh tail prims" so that only ONE mesh tail face is visible at any time.

What you are suggesting is placing an animated texture on a single face, because...

You didn't bother to read the damn question.
 

  • Like 2

Share this post


Link to post
Share on other sites

If the mesh was a single faced, uv fixed link, you could use llSetLinkTextureAnim() to "slide" a portion of an alpha texture across the uv's that expose said portion per frame.

 https://i.imgur.com/af9qFey.gif

This example is not "update heavy" as its just an animated texture. You still have to have the topology in place and are severely limited on texturing options.

Edited by Lucia Nightfire

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.


×
×
  • Create New...