[SOLVED] Texture doesn't apply to imported model

Hello, i thought of creating a new post for a problem related to previous one, I import a model from github then i apply the texture


but the texture isn’t shown on model, was wondering also about the mapping.json file that’s related to the model on github shouldn’t it work to load textures all together with the model?

I would do:

var material = thieves.model.meshInstances[0].material;
material.diffuseMap = app.assets.find('House1Surface1.jpg', 'texture').resource;

Thanks @will tried that but still texture is not shown yet

Hi @ayrin,

Can you post a simple sample project of your model/texture issue?


Good! Your issue was a missing variable: app is undefined

Try adding the following line at the top of your initialize method:

Test.prototype.initialize = function() {
            var app = this.app;

And it will work. Most likely you got used to Legacy scripts using app instead of this.app, but your code indeed is OK.

Yes, now it works, but with legacy script it doesn’t :frowning:

solved i have added var ops=app.assets; at the start of the code and ops.find(‘texture’,‘texture’) and it did the trick. Thanks guys.

1 Like