ayrin
March 4, 2020, 10:42am
#1
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
thieves.model.model.meshInstances[0].material.diffuseMap=app.assets.find('House1Surface1.jpg','texture').resources[0];
thieves.model.material.update();
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?
will
March 4, 2020, 11:36am
#2
I would do:
var material = thieves.model.meshInstances[0].material;
material.diffuseMap = app.assets.find('House1Surface1.jpg', 'texture').resource;
material.update();
ayrin
March 4, 2020, 11:58am
#3
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?
ayrin
March 4, 2020, 3:18pm
#5
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.
ayrin
March 4, 2020, 3:30pm
#7
Yes, now it works, but with legacy script it doesn’t
ayrin
March 4, 2020, 3:33pm
#8
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