Adding a Mirror
This post provides some sample code for using a mirror in your Vizard script and a short video demonstrating its use within the Vizard art gallery. You can apply the mirror settings to a flat model that you have in your environment or a texture quad that you add in your script. When you use the addMirror function you pass an object that will take on a mirror as its texture.
Download the mirror code for your version of Vizard. Each download includes an example for mono and stereo viewing.
mirror examples for Vizard 3 mirror examples for Vizard 4
Helpful Hints:
Give the mirror a glass-like appearance
To give the mirror a glass-like appearance that reflects but is also see through, use these settings on your mirror object:
mirror.appearance(viz.TEXMODULATE)
Change the orientation of the mirror
If you want to change the orientation of your mirror make sure you change the values in setEuler of the matrix object. In the following code a mirror is placed on the ground below us. We add a texture quad, rotate it so it's in the horizontal plane, and then add the mirror to its top side.
#set position .01 m above ground so ground and mirror do not intersect
mirror.setPosition(0,.01,0)
mirror.setEuler(0,90,0)
#specify the matrix
m = viz.Matrix()
m.setPosition(mirror.getPosition(viz.ABS_GLOBAL))
m.setEuler(-180,-90,0)
#Apply mirror settings to mirror object
addMirror(mirror,m)

