// powerplant Controller.js (function(){ this.preload = function(entityID){ var worldOriginPos = Entities.getEntityProperties(entityID, "position").position; var radius = 1000000; var offset = 0.28; var switchCoverID = Entities.findEntitiesByName("Visual_Object_Mark_scram-cover", worldOriginPos, radius); console.log("HELLOOOOOOO ",switchCoverID); var switchBaseID = Entities.findEntitiesByName("Visual_Object_Mark_scram-base", worldOriginPos, radius); console.log("HELLOOOOOOO ",switchBaseID); Entities.addAction("hinge", switchBaseID, { pivot: { x: 0, y: offset / 2, z: 0 }, axis: { x: 1, y: 0, z: 0 }, otherEntityID: switchCoverID, otherPivot: { x: 0, y: -offset / 2, z: 0 }, otherAxis: { x: 1, y: 0, z: 0 } }); } // this.unload = function(entityID) { // this.cleanup(); // }; // this.cleanup = function() { // //Script.stop(); // }; // Script.scriptEnding.connect(cleanup); })