"use strict"; (function () { // BEGIN LOCAL SCOPE // VARIABLES var _this = this; var mirrorScalerID; var mirrorToggleID; var mirrorScalerScriptURL = "http://mpassets.highfidelity.com/f9085148-02f3-401c-b823-1df9f616f362-v1/mScaler.js?2"; var mirrorToggleScriptURL = "http://mpassets.highfidelity.com/f9085148-02f3-401c-b823-1df9f616f362-v1/mToggle.js?2"; var defaultDimLength = 0.025; // ENTITY FUNCTIONS // Called only once when the script is loaded in. Creates mirror scalers and sets their names, IDs, and positions _this.preload = function(entityID) { print("preload mirror server"); _this.entityID = entityID; var mirrorProps = Entities.getEntityProperties(_this.entityID, ["position", "rotation", "dimensions"]); mirrorScalerID = Entities.addEntity({ name: "mirrorScaler", position: mirrorProps.position, rotation: mirrorProps.rotation, dimensions: {x: defaultDimLength, y: defaultDimLength, z: defaultDimLength}, angularDamping: 0.98, damping: 0.98, visible: false, dynamic: true, collidesWith: "", collisionMask: 0, collisionsWillMove: 1, userData: "{\"grabbableKey\":{\"grabbable\":true}}", type: "Model", shapeType: "simple-hull", modelURL: "http://mpassets.highfidelity.com/f9085148-02f3-401c-b823-1df9f616f362-v1/mirrorScaler.fbx?2", script: mirrorScalerScriptURL }); mirrorToggleID = Entities.addEntity({ name: "mirrorToggle", position: mirrorProps.position, rotation: mirrorProps.rotation, dimensions: {x: defaultDimLength, y: defaultDimLength, z: defaultDimLength}, angularDamping: 0.98, damping: 0.98, visible: true, dynamic: false, collidesWith: "", collisionMask: 0, collisionsWillMove: 1, userData: "{\"grabbableKey\":{\"wantsTrigger\":true}}", type: "Model", shapeType: "simple-hull", modelURL: "http://mpassets.highfidelity.com/f9085148-02f3-401c-b823-1df9f616f362-v1/mirrorToggle.fbx", script: mirrorToggleScriptURL }); } // Turns off mirror and deletes all mirror editors _this.unload = function(entityID) { print("unload mirror server"); Entities.deleteEntity(mirrorScalerID); Entities.deleteEntity(mirrorToggleID); }; })