Change material on click in object?.
29 April 2016 15:34
Change material on click in object?.You can do this in two ways:
1. with the logic editor
example, blend file
2. via API
code snippet
03 May 2016 13:01
Reply to post of user Yuri Kovelenov
You can do this in two ways:
1. with the logic editor
example, blend file
2. via API
code snippet
Thanks.
14 September 2016 15:41
my object name: mamparaOb
my material name: mamparaLight
this dont work for me in b4w 16.8.0, i get this error:
This:
return an empty array [ ] but my object have assigned one material named mamparaLight.
my material name: mamparaLight
var lightObMampara = m_scenes.get_object_by_name('mamparaOb');
// console.log(m_material.get_materials_names(lightObMampara));
// console.log(lightObMampara);
m_material.set_emit_factor(lightObMampara, "mamparaLight", 1);
m_material.set_diffuse_intensity(lightObMampara, 'mamparaLight', 1);
this dont work for me in b4w 16.8.0, i get this error:
B4W ERROR: Couldn't set property "emit_factor"!error @ print.js:73exports.set_emit_factor @ material.js:343main_canvas_click @ casaGasNatural.js:135
print.js:73 B4W ERROR: Couldn't set property "diffuse_color"!
This:
console.log(m_material.get_materials_names(lightObMampara));
15 September 2016 14:48
19 September 2016 12:27
19 September 2016 22:32
13 March 2017 09:29
13 March 2017 11:05
Hi! Are you using the set_alpha_factor method? It's for controlling those parameter that's located in the Texture->Influence panel in Blender. If you want to change the opacity of an object you should use the set_diffuse_color method and change the last component of the "color" parameter:
[EDIT] forgot to mention that this is for non-node materials only, if you're using nodes you can do it as jeanpierre3d suggests below
m_mat.set_diffuse_color(cube, "MyMaterial", [1, 1, 1, 0.3]);
[EDIT] forgot to mention that this is for non-node materials only, if you're using nodes you can do it as jeanpierre3d suggests below
13 March 2017 11:07
hello just do an alpha control
i use node material with a value controling the alpha in extinded material
with a script
and i check transparenty in the material tab and choose alpha blending or alpha sort
it may help you
i use node material with a value controling the alpha in extinded material
with a script
m_mat.set_nodemat_value(myObject, ["Texture.myObject.001", "Value.myObject.alpha"],1);
and i check transparenty in the material tab and choose alpha blending or alpha sort
it may help you