"Mirroring Package" - All You Need to Know Guide!

Hello there! I have created a package that offers 2 things:

    • Quickening development time for areas like hallways, forests, and other areas where there are lots of entities that are either extremely organized/symmetrical or need a lot of “depth” to look good (i.e. a forest of trees).
    • Unique gameplay features that utilize reflections, symmetry, and mimicry.

Before getting into it, you can see the package in action here: Crayta

----- INTRODUCTION ------
The package/set of scripts allow you to create copies of entities in the world. The copies mirror the position, rotation, and (if available) the “LookAt” of entities.

While the possibilities are endless, some uses are:

  • Create a large mirror effect in a surreal world.
  • Duplicate the decorations/entities in a long hallway by only building half.
  • Extend the visual boundaries of your game by doubling the depth of a forest of trees (or other border of entities).
  • Create a haunted house that has a mirror effect in a room that shows the players as skeletons.
  • Have a vampire effect for certain players (vampires don’t have reflections) in a competitive game.
  • Create a maze of mirrors that players have to traverse.
  • A fake path in an obstacle course that looks just like the real one.

----- HOW IT WORKS ------
In one word: math. By using (a lot of) algebra, we are able to determine an equation for a mirror’s plane. That equation then acts as the cornerstone for all the other algebra to determine positions, distances, angles, and rotations of other entities in the game.

Recording all of these numbers allows the game to create a new environment behind the mirror that mimics what is in front of it.

----- HOW TO USE ------

  • MirrorManagerScript: This script goes on one entity in the world that will not be deleted or removed during the game. This is normally a simple locator. Its purpose is to keep track of all of the entities in the world that have a MirrorTemplateScript on them and control requests that come in for entities to be mirrored.

  • MirrorTemplateScript: This script goes on all templates that can be mirrored in the game. Without this script, templates do not get added to the MirrorManagerScript’s table and cannot be mirrored.

  • MirrorPlayerScript: This script gets added to the Player Template and acts similarly to the MirrorTemplateScript, but is only for the Player. There is one additional property on this script for Players versus other Templates.

  • MirrorScript: This script goes on the “mirror” in the world. This script handles all of its own calculations and functions so that the entities get mirrored properly. This script defines the plane of the mirror and is important to add to each of the mirrors you want to have active in the game.

  • MirrorTriggerScript: Attached to every mirror, should be a trigger. That trigger should have this script on it. In the properties of the trigger you will assign which mirror should be actively mirroring an entity when it is in the trigger.


    • Create an entity (usually a locator) and attach the MirrorManagerScript to it.
    • Create a “mirror” in the world by putting the MirrorScript on an entity.
    • Add 2 locators to the “mirror” - one at each end of the mirror’s plane.
    • Define the peoperties of the “mirror” by choosing the first locator as mirrorPointA and the second locator as mirrorPointB. Congratulations, the mirror is now set up to reflect along the invisible line connected between the two locators!
    • Add a trigger to the world. This can be as a child to the “mirror” for organization, but is not necessary. This trigger can be any size you want.
    • Add MirrorTriggerScript to the trigger.
    • In the trigger’s properties, define the mirror property by selecting the “mirror” entity that you created in step 2.
    • Add a new binding to the requestForMirror event on the trigger with the following details:
      Entity: Choose the entity that you put the MirrorManagerScript on in step 1 (or blank).
      Script: MirrorManagerScript
      Event: RequestToMirror
    • Create a Template of the object(s) you want to have mirrored.
    • Attach MirrorTemplateScript to those Templates.
    • The “mirrorable” property should be checked.
    • Add binding to the RollCall event on the template with the following details:
      Entity: Choose the entity that you put the MirrorManagerScript on in step 1 (or blank).
      Script: MirrorManagerScript
      Event: ReflectablesRollCall
    • If a Template will not be moving throughout the game, find the “stationary” property in the MirrorTemplateScript and check it. This will help minimize the impact on performance.

      Repeat steps 9 through 13 for all Templates you want to be mirrored in game.

    • Add MirrorPlayerScript to the Player Template.
    • Create an NPC Template, because Players cannot be duplicated themselves. This is what players will reflect as in your game.
    • Set the “mirroredTemplate” property to be the NPC Template created in step 14.
    • Add binding to the RollCall event on the template with the following details:
      Entity: Choose the entity that you put the MirrorManagerScript on in step 1 (or blank).
      Script: MirrorManagerScript
      Event: ReflectablesRollCall

Congratulations! You now have a working Mirror Package!

----- OTHER NOTES ------
Here are a few other notes that could be important while you use this package:

    • To contact the creator of this package, use Discord and ask for TBomb. If Discord is not available to you, you can also try the official Crayta Facebook Group for assistance.
    • Character emotes, crouching, and jumping are currently not mirrored by the NPCs. If you would like to see this feature added, reach out via Discord/Crayta Facebook Group!
    • If you want an entity to be duplicated and it is not going to be moving in the game, it is recommended that you check the “stationary” property on the template to help with game performance.
    • You can use any entity as your “mirror” or turn the “mirror” invisible in the entity’s properties. This will give you flexibility on how you would like the game to make use of the mirroring effect.
    • To mirror a Light, start with a Locator or other Mesh and attach a Light to that. A Locator will not be seen by Players and the mesh can be turned invisible so that Players will not see them.
    • All mirrored objects will match the Template, not the exact version in the game (if the “real” version of the entity has been modified (size, damage, kitbashing, etc.).
    • Please let me know if you have any comments, questions, requests, or issues via the Discord or Crayta Facebook Group.
1 Like

For a video walkthrough of this guide, check out this YouTube video: Crayta - Setup the Mirroring Package by TigerTitan - YouTube