Sure, if you select the right material and that material uses a diffuse color. Then it will.
You can see that here that we are implementing material on run time So how will i do the referencing for that ?
I don’t see any difference, if it’s a Playcanvas material just do the same:
var material = this.entity.model.meshInstances[0].material;
material.opacity = 1.0;
material.diffuse.fromString('#F4CB01');
material.update();
Getting this error :
TypeError: Cannot set property ‘opacity’ of undefined
Can you post your code please?
Nevermind, I see your code here:
this.entity.addComponent("model"),
this.entity.model.model = d,
this.entity.model.meshInstances[0] = this.Mymaterial.resource,
product = this.entity;
var u = this.entity.model.meshInstances[0].material;
u.opacity = 1,
u.diffuse.fromString("#000000"),
u.update()
This line is odd
this.entity.model.meshInstances[0] = this.Mymaterial.resource
Why is app setting a material to a meshInstance?
Not working !
What’s not working? I didn’t post a fix to the code, just pointed out where the code I saw in your app that doesn’t look right.
Are these errors expected at this stage of development?
Yes showing but the color and opacity is changing !
Sorry, you need to be clearer about
- what your problem is (if you are still getting problems)
- what your error is
- which project or webpage you are getting it
- how to reproduce the error
We are creating Product configurator where we are importing models on runtime that’s working fine(http://network.daruldev.com/Edit-3d-models/12) and also creating material on runtime that’s also working fine(http://network.daruldev.com/Edit-materials/1) But when we are implementing that material on model here(http://network.daruldev.com/Edit-product_variations/2) Its not working. That’s the main problem.
Not showing any error on material.opacity and so on
http://network.daruldev.com/Edit-product_variations/2
https://playcanvas.com/project/712735/overview/obj-loader-3
that’s what i want !
TypeError: Cannot set property ‘opacity’ of undefined
Or
Not showing any thing !