Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I want to know if it is possible to modify transparancy of an png image attached to a 2D mesh through js scripting/actions etc. 2D_Overlay meshes do have the "Alpha" property but I can't use them, as my image and 2d Mesh are to large (approx 10x device.width). Feature needed for the android platform. thanks |
||||
|
Scripting Window: ================= // try some transparancy settings var s = ccbGetSceneNodeFromName("MapBox_planeMesh"); var thing = ccbGetSceneNodeProperty(s, "Type"); print("The thing's Type is " + thing); var t = ccbGetSceneNodeMaterialProperty(s, 0, "Texture1"); print("The plane texture is " + t); var diff = ccbGetSceneNodeMaterialProperty(s, 0, "Diffuse"); print("The plane init difuseness is at " + diff); var vect = new vector3d(255, 0, 0); ccbSetSceneNodeMaterialProperty(s, 0, "Diffuse", vect); var diff = ccbGetSceneNodeMaterialProperty(s, 0, "Diffuse"); print("The plane new difuseness is at " + diff); ccbSetSceneNodeMaterialProperty(s, 0, "trans_add", 125); ccbSetSceneNodeMaterialProperty(s, 0, "trans_alphach", 125); // var trans = ccbGetSceneNodeMaterialProperty(s, 0, "trans_add"); print("The plane transparancy is at " + trans); Message Log: ============ The thing's Type is mesh The plane texture is c:\users\douwe dabbe\downloads\0-app-stuff\scr-screenshot\mapbox-layer-deventer.png The plane init difuseness is at (0, 0.007843, 0.333333) The plane new difuseness is at (0, 0.007843, 0.333333) The plane transparancy is at false |
||||
|
You CAN change the alpha - its called 'Param1' !! Full transparency starts at 0.99 and goes down to 0.01 for full opaque. If you stick a plane in front of the players camera with the texture you want to change alpha for - you can do that now.... |
|