I’m simulating an arrow movement by changing the Texture.OffsetStudsU
property.
Although Texture.OffsetStudsU says that this property number is of type float
, when I set a value too high, the texture gets scrambled.
For example, when OffsetStudsU is set to 100,000, it’s ok:
But if I change this value to 10,000,000:
How to avoid this?
What’s the max number I can set in Texture.OffsetStudsU?
Why do you need this? Can’t you wrap the texture around at the width of the part?
I’m simulating the arrow movement, an animation (BindToRenderStep).
So I need to gradually increase the Texture.OffsetStudsU
to get this effect.
But once you hit the length of the texture, you can wrap it around to 0. Numbers have limits.
I did not understand. Could you show a code for this?
Currently, for each render step, I make this:
Part.Texture.OffsetStudsU += 0.01
if Part.Texture.OffsetStudsU > 100000 then
Part.Texture.OffsetStudsU = 0
end
blokav
(blokav)
#6
You can use modulus to wrap the offset back once you reach the tile width.
Part.Texture.OffsetStudsU += 0.01
Part.Texture.OffsetStudsU = Part.Texture.OffsetStudsU % Part.Texture.StudsPerTileU
3 Likes