|
ChaiBoy Rang
Registered User
Join date: 9 Mar 2007
Posts: 29
|
08-04-2007 20:00
I am trying to make a conveyor belt type animated texture. My script stops when the offset reaches 1. what am i doing wrong float rotate;
default { state_entry() { rotate = 0; llSetTimerEvent(.1); }
timer() { rotate = rotate + .1; if (rotate==1.0) { rotate = 0.0; } llOffsetTexture(rotate,0,ALL_SIDES); } }
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
08-04-2007 22:55
You're probably running into the subtle inaccuracy of 32-bit floats. It's impossible to represent the decimal value 0.1 in binary, it ends up an infinitely repeating sequence, similar to 1/3 in decimal. By repeatedly adding the *binary approximation* of 0.1, your float value never ends up *exactly* equalling 1.0, which is what you're testing for. Texture Offset values can't exceed 1.0, but since your terminating condition is never met, the value never resets to zero, hence invalid values > 1.0 are repeatedly passed to llOffsetTexture, and ignored, hence it appears to stop at 1.0. Try testing for values greater-than 1.0 instead.
BTW, what you're trying to do would be much more efficiently handled with a texture anim.
|
|
Patti Frye
Registered User
Join date: 25 Aug 2006
Posts: 60
|
08-19-2007 13:07
Hi Deanna I'm trying to do something similar. I have a computer monitor and I need the screen to scroll continually. I've never tried animated textures before. How would I do this with the animated texture script? Or is there somewhere on the wiki that I might look for myself? I assume I would need 2 or more textures that scroll into each other. Any help would be greatly appreciated.
|
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
08-19-2007 15:52
From: Patti Frye Or is there somewhere on the wiki that I might look for myself? lslwiki.net/lslwiki/wakka.php?wakka=llSetTextureAnim From: someone I assume I would need 2 or more textures that scroll into each other. Nope, just a single texture containing multiple tiled "frames" of the animation, or, in your case, a single continuous texture which you animate with the SMOOTH option. Note, however, that smooth animation only operates in the horizontal axis of the texture, so if you want something like lines of text scrolling vertically on a screen, you'll need to create your texture with the text lines running vertically and rotate it 90 when applying to the prim.
|
|
Patti Frye
Registered User
Join date: 25 Aug 2006
Posts: 60
|
08-19-2007 16:47
Thank you that did it. Just what I was looking for.
|