ImageMirror: clip

clip
  • set/get the clipping distance (from mirror).

Type: 

  • float number
  • Range: 0.01 to 5000.00 Blender Units
  • Default Range: 100.00 Blender Units
Note:
  • clip is the maximum reflection distance from the mirror.
     
  • If you set the clip to 5.0, anything more than a distance of 5.0 won't be reflected.
Sample Code

###################### get the clip distance

# import bge module
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get list of objects in scene
objList = scene.objects

# 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")

# get a list of the cameras
camList = scene.cameras

# get the camera named PlayerOne
cam = camList["PlayerOne"]
           
# texture I'm using for the mirror is in first texture channel
texChannel = 0

# get the texture
mirror = bge.texture.Texture(obj, matID, texChannel)

# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)

# get max reflection distance
dist = mirror.source.clip

# save mirror as an object variable
obj["Mirror"] = mirror

# update mirror
mirror.refresh(True)

Sample Code

###################### set the clip distance

# import bge module
import bge

# get current scene
scene = bge.logic.getCurrentScene()

# get list of objects in scene
objList = scene.objects

# 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")

# get a list of the cameras
camList = scene.cameras

# get the camera named PlayerOne
cam = camList["PlayerOne"]
           
# texture I'm using for the mirror is in first texture channel
texChannel = 0

# get the texture
mirror = bge.texture.Texture(obj, matID, texChannel)

# get the mirror source
mirror.source = bge.texture.ImageMirror(scene, cam, obj, matID)

# set clip distance
mirror.source.clip = 10.0

# save mirror as an object variable
obj["Mirror"] = mirror

# update mirror
mirror.refresh(True)