Using Mirrors
-
Prerequisite
Description
You can add mirrors to your scene, which will reflect other objects. Mirrors can often help you create fun and beautiful experiences.
To use a mirror, you need to take 3 steps:
- Add an object to your scene as usual, such as a plane or a box.
- Convert that object to a mirror with this block:
- Set another object to be reflected in the mirror.
Let’s discuss steps 2 and 3 below.
Converting an object to a mirror
To convert any 3D shape into a mirror, you need to use the following block:
- Brightness: this value controls the brightness of the reflected image in the mirror. When it is at 100%, the object inside the mirror will look the same as the real object. Here is a comparison of brightness values of 100, 30 and 5:
- Object Name: the name of the object to be converted to the mirror. If this is left blank, then the current sprite object will be used.
Setting a target object
By default, a mirror will only reflect the sky and ground in the scene, and nothing else. This will save computations for calculating mirror images. If you need to show a specific object in a mirror, you need to use the following block:
The input is the name of the mirror (the object that’s converted to a mirror). If you leave it blank, the last added mirror will be used. After you run this block, the current sprite object will be added to the “reflection list” of the mirror, which is a list of objects that the mirror has to reflect.
Different Shapes of the Mirror Object
You can convert the following types of objects to mirrors:
- Plane: planes only have one visible face, and that face can be converted to a mirror. Here is an example of a rotating plane as a mirror. Note that the mirrors can be colored as well.
- Box: a box has 6 faces, so all faces will be converted to mirrors. Here is an example:
- Sphere: spheres do not have flat faces, so they will show distorted images.
- Extruded Object: when you extrude any 2D shape into a 3D object, its front face will be converted to a mirror of the same shape. Note that when using extruded objects as mirrors, there is always a “ghost” mirror image on the back face, so you need to cover up the back face of the mirror object with another object.
- Other Shapes: when you try to convert any other type of shape into a mirror, such as a model or a cylinder, you will get a similar result to using a sphere mirror. The reflected image will be distorted. Still, it will make the object look shiny when it reflects the blue sky.
Remove Objects from Mirror
If you want to stop a mirror from reflecting any other objects, you can use this block: