added portkey to posters

This commit is contained in:
ericrius1 2016-03-30 10:07:04 -07:00
parent fa5376bc86
commit cbb6c5fe98
2 changed files with 71 additions and 0 deletions

View file

@ -60,6 +60,35 @@
"shapeType": "compound",
"type": "Model",
"userData": "{\"hifiHomeKey\":{\"reset\":true}}"
},
{
"color": {
"blue": 255,
"green": 0,
"red": 255
},
"name": "home_sphere_cellsciencePortkey",
"href": "hifi://cellscience",
"script": "atp:/switches/portkey.js",
"visible": false,
"dimensions": {
"x": 0.111,
"y": 0.111,
"z": 0.111
},
"position": {
"x": 0.0,
"y": -0.2,
"z": 0.0
},
"queryAACube": {
"scale": 0.25831151008605957,
"x": -0.12915575504302979,
"y": -0.12915575504302979,
"z": -0.10074388980865479
},
"type": "Sphere",
"userData": "{\"hifiHomeKey\":{\"reset\":true}, \"grabbableKey\": {\"wantsTrigger\": true}}"
}],
"Version": 57
}

View file

@ -0,0 +1,42 @@
//
// portkey.js
//
//
// Created by Eric Levin on 3/28/2016
// Copyright 2016 High Fidelity, Inc.
//
// This entity script is designed to teleport a user to an in-world location specified in object's userdata
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
(function() {
Script.include("atp:/utils.js");
var _this = this;
this.startFarTrigger = function() {
_this.teleport();
}
this.startNearTrigger = function() {
_this.teleport();
}
this.startNearGrab = function() {
_this.teleport();
}
this.teleport = function() {
Window.location = _this.portkeyLink;
}
this.preload = function(entityID) {
_this.entityID = entityID;
_this.portkeyLink = Entities.getEntityProperties(_this.entityID, "href").href;
}
});