Advertisement
salahzar

teleportAlClick.js

Jul 21st, 2018
634
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //UserData:
  2. //{
  3. //  “path”: “/path obtained with navigate copy path”,
  4. //  “grabbableKey”: {
  5. //      “grabbable”: false
  6. //  }
  7. //}
  8. (function () {
  9.  
  10.    
  11.     var path = null;
  12.     var properties = null;
  13.  
  14.  
  15.     this.clickDownOnEntity = function (entityID, mouseEvent) {
  16.         print("clicked by Salahzar");
  17.         properties = Entities.getEntityProperties(entityID, ["position", "userData"]);
  18.         if (!properties.userData) {
  19.             print("Click Teleporter " + entityID + " missing user data.");
  20.             return;
  21.         } try {
  22.             teleportData = JSON.parse(properties.userData);
  23.             print("Path " + teleportData.path);
  24.            
  25.             url = location.hostname;
  26.             location = "hifi://" + url + teleportData.path;
  27.            
  28.         } catch (e) { }
  29.     }
  30.  
  31. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement