// // Created by Sam Gondelman on 8/10/16 // Copyright 2016 High Fidelity, Inc. // // Spawns a pokestop that will react to the closest avatar // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // // references to our assets. entity scripts need to be served from somewhere that is publically accessible -- so http(s) or atp // https://hifi-content.s3.amazonaws.com/samuel/createPokestop.js var SCRIPT_URL = "https://hifi-content.s3.amazonaws.com/samuel/pokestop.js"; var SHADER_URL = "https://hifi-content.s3.amazonaws.com/samuel/pokestop.fs"; // this part of the code describes how to center the entity in front of your avatar when it is created. var orientation = MyAvatar.orientation; orientation = Quat.safeEulerAngles(orientation); orientation.x = 0; orientation = Quat.fromVec3Degrees(orientation); var center = Vec3.sum(MyAvatar.getHeadPosition(), Vec3.multiply(2, Quat.getFront(orientation))); // An entity is described and created by specifying a map of properties var cow = Entities.addEntity({ type: "Box", name: "example_pokestop", position: center, dimensions: { x: 2.0, y: 4.0, z: 2.0 }, script: SCRIPT_URL, userData: JSON.stringify({ ProceduralEntity: { version: 2, shaderUrl: SHADER_URL, uniforms: { cubeTime: 0.0, growTime: 0.0, distTime: 0.0 } } }) }); Script.stop();