Moving UVs?

Software: Away3D 4.x

Alex Bogartz, Sr. Member
Posted: 08 March 2012 11:41 PM   Total Posts: 216

This may have a simple answer, but is it possible to move the UVs of a plane over time?  I have a tiling water texture and I want to move it slowly, but I don’t think I need a full water effect like in the shallow water demo.

Can someone point me in the right direction?

   

Alex Bogartz, Sr. Member
Posted: 08 March 2012 11:50 PM   Total Posts: 216   [ # 1 ]

Ok, that was weird, but it’s like this:

TextureMaterial(water.material).animateUVs = true;
Mesh(water).subMeshes[0].offsetU+= 0.0001;

   

John Brookes, Moderator
Posted: 09 March 2012 02:18 PM   Total Posts: 732   [ # 2 ]

Just to add to this.

If you set animateUVS say when you load/create the material but don’t actually update the offsetU/V till say keypress or something, it moans like crazy and constantly traces.

Warning: animateUVs is set to true with an IRenderable without a uvTransform. Identity matrix assumed.

So give it a setting

TextureMaterial(water.material).animateUVs = true;
Mesh(water).subMeshes[0].offsetU = 1;

onKey
Mesh(water).subMeshes[0].offsetU+= 0.0001;

Another thing dont actually do
Mesh(water).subMeshes[0].offsetU+= 0.0001;

if it runs long enough eventually the UVs get messsed up
do something like
Mesh(water).subMeshes[0].offsetU = Mesh(water).subMeshes[0].offsetU % 1 + 0.0001;

At least that what my little tests found:)

   

Avatar
Fabrice Closier, Administrator
Posted: 09 March 2012 02:28 PM   Total Posts: 1265   [ # 3 ]

repeat is set to true?

   

John Brookes, Moderator
Posted: 09 March 2012 02:56 PM   Total Posts: 732   [ # 4 ]

repeat doesn’t matter (no difference).

What I think it is, similar to a thing used to do happen papervison.
Eventually the offset will be bigger than the max bitmap size of flash and it freezes.

extreme example but gets you to UV lock
yourMesh.subMeshes[0].offsetU += 2000.1

   

Alex Bogartz, Sr. Member
Posted: 09 March 2012 04:11 PM   Total Posts: 216   [ # 5 ]

Thanks, will try it!

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X