[SOLVED] Animating Material on Model Using Offset & Tiling

Hi all!

I’m having a bit of a problem when trying to simulate a marquee animation on a model by animating the material. Basically, I want the material to scroll across the entity in the update function. I want to use the Offset & Tiling section of the material to do this, as I can see that when I change the offset value in the editor, it updates the position appropriately on the model.

My question is, what property in the docs corresponds to the offset value I am changing in Offset & Tiling? I’m looking here:

https://developer.playcanvas.com/en/api/pc.StandardMaterial.html

I’ve looked at this post:

and also the Flappy Bird project, as well as the Animating Textures tutorial, but it seems those are all using different approaches, whereas I’m trying to offset the position of the actual material itself, but I can’t figure out which property to update from pc.StandardMaterial in my script to do this.

Any help would be be greatly appreciated!

You need:

https://developer.playcanvas.com/en/api/pc.StandardMaterial.html#diffuseMapOffset
https://developer.playcanvas.com/en/api/pc.StandardMaterial.html#diffuseMapTiling

Those are the properties for tiling and offset of the diffuse map. But there are equivalent properties for most of the other map types.

To use, just do:

material.diffuseMapOffset.set(offsetu, offsetv);
material.diffuseMapTiling.set(tilingu, tilingv);
1 Like

Awesome, thanks will! That worked. :slight_smile:

1 Like