
- Creates a realtime mirror.
Return Type:
- Video Texture Mirror Object
scene:
- Scene where the mirror is located.
- Type: KX_Scene
- Camera being used.
- Type: KX_Camera
- Object being used as the mirror.
- Type: KX_Object
- The index of the material being used as the mirror.
- Type: integer

###################### create a real time mirror
# import bge module
import bge
# get current scene
scene = bge.logic.getCurrentScene()
# get list of objects in scene
objList = scene.objects
# get a list of the cameras
camList = scene.cameras
# get the camera named PlayerOne
cam = camList["PlayerOne"]
# get object named Mirror
obj = objList["Mirror"]
# get the mirror material ID
# Name of my Mirror material is Reflect
matID = bge.texture.materialID(obj, "MAReflect")
# texture I'm using for the mirror is in first texture channel
texChannel = 0
# get the texture to be used as a mirror
mirror = bge.texture.Texture(obj, matID, texChannel)
# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)
# save the mirror as an object variable
obj["Mirror"] = mirror
# update the mirror image
mirror.refresh(True)