
- get/set the alpha transparency of the material
- float number
- 0.0 to 1.0
- 0.0 = complete alpha transparency
- 1.0 = no alpha transparency
- Transparency must be enabled in the game settings
- Properties menu >> Material >> Transparency checkbox

################## get material alpha transparency
# import bge
import bge
# get the current controller
controller = bge.logic.getCurrentController()
# get object that owns this controller
obj = controller.owner
# There's only one mesh on my model
mesh = obj.meshes[0]
# And only one material on the mesh
mat = mesh.materials[0]
# get material transparency
mat_trans = mat.alpha
################## set material transparency
# import bge
import bge
# get the current controller
controller = bge.logic.getCurrentController()
# get object that owns this controller
obj = controller.owner
# There's only one mesh on my model
mesh = obj.meshes[0]
# And only one material on the mesh
mat = mesh.materials[0]
# set alpha transparency
mat.alpha = 0.5