ChaosRaine Posted March 10, 2014 Share Posted March 10, 2014 I assume I'm missing something stupid. I'm trying to make a sculpty book with a rotating texture so that it looks like a simple animation is playing on the cover. The script works fine in a prim but not in the book. Any ideas? Here's what I'm using integer randomletter; string winnerletter; float cell_width = 0.2; float cell_height = 0.5; float cell_widthnum = .5; float cell_heightnum = .5; integer timernum; integer changenumber = 1; integer counter; integer max = 10; getnewletter() { randomletter = (integer)llFrand(11); // Some integer 0 - 25 float row_number = 1.5 - (integer)(randomletter / 5); float column_number = (randomletter % 5) - 3.5; llOffsetTexture(column_number * cell_width, row_number * cell_height, 2); ///////////******** // SET A NEW PRIZE } default { state_entry() { llSitTarget(<-1.2,0.0,.1>,llEuler2Rot(<0.0,0.0,-90.0>*DEG_TO_RAD)/llGetRot()); float row_num = 1.5; float column_num = - 1.5; llSetTexture("eba57635-249b-4495-6d1e-4ee33e49e5fc",0); llScaleTexture(cell_width, cell_height, 0); getnewletter(); timernum = (changenumber*1); llSetTimerEvent(timernum); } timer() { getnewletter(); }} The texture is five wide and two high. I'm retro fitting an old script so my variable names don't make sence don't let them confuse you. Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 10, 2014 Share Posted March 10, 2014 The problem is going to be that a sculpty has only one face, and that face is folded like a piece of origami paper. The part that is the cover of your book is only one area on that face, so you won't be able to change it independently of the rest of the texture on the book. In fact, unless you are very lucky it will be a challenge to use any sort of dynamic texture. If it were my project, I'd remake the book as a mesh object, thus getting more detail (possibly with a lower L.I. too) and having a separate face to use for the cover texture. To make your script work with it, I'd have to be careful to make a separate UV map that dedicates all of its area to that one face so that there's a 1:1 correspondence between the dimensions of your texture and the UV map itself. If that seemed like too much work, I'd link a flattened cube prim to the sculpty book and use that as the cover. You know that your script will work on that. If you set Physics Shape Type to Convex Hull, you might even avoid increasing its L.I. .... maybe. Link to comment Share on other sites More sharing options...
ChaosRaine Posted March 10, 2014 Author Share Posted March 10, 2014 Yeah I'm ok with it changing the texture on the entire book at once. The only change in each rotatation is the cover. It might be easier to just make the ten diffrent textures and make the script switch to an entirly new texture rather then rotate it. The only problem with that is I would hate to spend 100L on a book that is going to be worth maybe 15L. Link to comment Share on other sites More sharing options...
Rolig Loon Posted March 10, 2014 Share Posted March 10, 2014 Well, as I suggested, the easy way out is to link a new flattened cube prim to your sculpty book and use it as the cover. Then you can use your script as is. I'm assuming that the cover is flat, so you can get away with a trick like that. Link to comment Share on other sites More sharing options...
LepreKhaun Posted March 10, 2014 Share Posted March 10, 2014 Hey ChaosRaine! If you can successfully apply a book texture to it: Do a 5x2 grid texture as you were doing before but simply rotate the design on the front of the book 1/10th around each frame. The frames start from left to right across the top and then from left to right across the second row. Bottom right frame is the end point. NOTE: In making the grid texture, care must be used to place each frame exactly to keep the book from "jittering". Use Frame -> Duplicate Frame and your arrow keys with the Move tool, zoom in to make sure you don't "gap" any of the copies. Then forget your getnewletter() function and timer event. Instead, use LlSetTextureAnim using LOOP. (specifically- llSetTextureAnim( ANIM_ON|LOOP, ALL_SIDES, 5, 2, 0.0, 10.0, rate ); where rate is a float variable you set for how fast you want the rotation to occur. If you're having problems with how the sculpty is mapped, let us know- there's an answer for that as well... 1 Link to comment Share on other sites More sharing options...
ChaosRaine Posted March 11, 2014 Author Share Posted March 11, 2014 So something like this then? default{ state_entry() {float row_num = 1.5;float column_num = - 1.5; llSetTexture("eba57635-249b-4495-6d1e-4ee33e49e5fc",ALL_SIDES); llScaleTexture(cell_width, cell_height, 0); llSetTextureAnim( ANIM_ON|LOOP, ALL_SIDES, 5, 2, 0.0, 10.0, 1); }} I got that to work on a prim box the way I want it to, but it doesn't seem to be positioning right on the sculpty and it looks like its playing the animation on the sculpty. I can't seem to get the positioning done though. Is it mostly just about playing with it and finagling something to get it to work or is there an easier way to position it? Link to comment Share on other sites More sharing options...
Dora Gustafson Posted March 12, 2014 Share Posted March 12, 2014 A sculpty has only one face, so each frame in your loop will cover it all no matter what you do The solutions have been outlined earlier in this thread Replace the sculpty with a mesh model with proper faces Use a linked box prim to display your frames Another thing is you can not scale or rotate a texture in a text animation, the llSetTextureAnim() function assumes a frame will fill the face and it will assume what is up, down, left and right The face must be chosen or created to accommodate that :smileysurprised::smileyvery-happy: Link to comment Share on other sites More sharing options...
LepreKhaun Posted March 12, 2014 Share Posted March 12, 2014 ChaosRaine wrote: So something like this then? default{ state_entry() {float row_num = 1.5;float column_num = - 1.5; llSetTexture("eba57635-249b-4495-6d1e-4ee33e49e5fc",ALL_SIDES); llScaleTexture(cell_width, cell_height, 0); llSetTextureAnim( ANIM_ON|LOOP, ALL_SIDES, 5, 2, 0.0, 10.0, 1); }} I got that to work on a prim box the way I want it to, but it doesn't seem to be positioning right on the sculpty and it looks like its playing the animation on the sculpty. I can't seem to get the positioning done though. Is it mostly just about playing with it and finagling something to get it to work or is there an easier way to position it? Yes, but row_num and col_num aren't required when using llSetTextureAnim(). But scratch that idea I just thought of a much simpler solution! A book-sized mesh will link to a prim and still result in a LI of 1 So, you could link a cylinder to a "builder's" mesh book and then simply use ANIM_ON | SMOOTH | ROTATE | LOOP (as given in the wiki in the example showing rotation). Like so: Attributions: Book is "*'M n B* Book 2 mesh" and cost L$0 on the Marketplace Design is named MD Celtic Illumin Tile I from the "MD Celtic Design Tiles Set" and cost L$150 on the Marketplace Link to comment Share on other sites More sharing options...
Recommended Posts
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