Jump to content

[SOLVED] Can't change opaque object to transparent in run time


photo

Recommended Posts

I have object with opaque material. And I need to set transparency to it in run time.

I try such code (obj - Unigine.Object variable, i - number of object's surface):

Material material = obj.getMaterial(i);
material.setTransparent(Unigine.Material.TRANSPARENT_BLEND);
obj.setMaterialParameter("transparent", new vec4(0.6f, 0.6f, 0.6f, 0.6f), i);
obj.setMaterialParameter("transparent_pow", new vec4(0.6f, 0.6f, 0.6f, 0.6f), i);

It works only if material of the object is initially transparent.

How to solve my problem?

 

Edited by kzaharov
Link to comment
  • silent changed the title to [SOLVED] Can't change opaque object to transparent in run time
×
×
  • Create New...