[SOLVED] Increase Material Diffuse Map Offset not working

[SOLUTION] :100:
For whoever in the future who is interested in this topic, this are my final results:

Script

var TextureDisplace = pc.createScript('textureDisplace');

TextureDisplace.attributes.add('materialAsset', {type: 'asset', assetType: 'material'});
TextureDisplace.attributes.add('velocity', {type: 'number'});

TextureDisplace.prototype.initialize = function() {
    this.currentOffset = 0;
    this.material = this.materialAsset.resource;
};

TextureDisplace.prototype.update = function(dt) {
    this.currentOffset -= this.velocity * dt;
    
    if (this.currentOffset <= -1) {
        this.currentOffset += 1;
    }
    
    this.material.setParameter(
        'texture_diffuseMapTransform', 
        [this.material.diffuseMapTiling.x, this.material.diffuseMapTiling.y, this.material.diffuseMapOffset.x, this.currentOffset]
    );
};

Material Values (A little bit changed in order to allow the script update them)

3 Likes