Search the Community
Showing results for tags 'materiallibrary'.
-
Hi guys, I am new to unigine and this forum, sorry if I am duplicating topic. I am working on selection decals ( selection ring around unit(s)/structure while they are selected ). What I want is to create lots of decals from one base material with different ( random ) colors using "color_scale" parameter to distinguish each of them. I mean unit selection ring according to player color. This is what I did till now but it's not working : strMaterial is base material. string strMaterialWithColor = format("%s, %.2f, %0.2f, %0.2f, %0.2f", strMaterial, vColorModifier.x, vColorModifier.y, vColorModifier.z, vColorModifier.w); int idLibrary = engine.materials.findLibrary("world1.mat"); if(idLibrary == 0) { idLibrary = engine.materials.addWorldLibrary("world1.mat"); } if(idLibrary == 0) { strMaterialWithColor = strMaterial; } if(idLibrary != 0 && engine.materials.findLibraryMaterial(idLibrary, strMaterialWithColor) == -1) { int idMaterial = engine.materials.cloneMaterial(strMaterial, "world1.mat", strMaterialWithColor); Material mat = engine.materials.getMaterial("world1.mat", idMaterial); mat.setParameter("color_scale", vColorModifier); } else { strMaterialWithColor = strMaterial; } DecalOrtho decal = new DecalOrtho(vPos.z + DECAL_PROJECTOR_OFFSET, 2, 2, strMaterialWithColor ); Please help me.