const CLOCK_BODY_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/cuckooClock/cuckoo2_BODY.fbx"; const CLOCK_FACE_URL = "http://hifi-content.s3.amazonaws.com/DomainContent/Home/cuckooClock/cuckoo2_FACE.fbx"; var orientation = Camera.getOrientation(); orientation = Quat.safeEulerAngles(orientation); orientation.x = 0; orientation = Quat.fromVec3Degrees(orientation); var center = Vec3.sum(MyAvatar.position, Vec3.multiply(3, Quat.getFront(orientation))); // Math.random ensures no caching of script var SCRIPT_URL = Script.resolvePath("cuckooClockEntityScript.js?v1" + Math.random()) var clockbodyEntity = Entities.addEntity({ type: "Model", modelURL: CLOCK_BODY_URL, animation: {url:CLOCK_BODY_URL, running: false, currentFrame: 0, loop: true}, position: center, dimensions: { x: 0.8181, y: 1.3662, z: 0.8181 }, script: SCRIPT_URL }) var clockfaceEntity = Entities.addEntity({ type: "Model", modelURL: CLOCK_FACE_URL, // animation: {url:CLOCK_BODY_URL, running: false, currentFrame: 0, loop: true}, position: center, dimensions: { x: 0.8181, y: 1.3662, z: 0.8181 }, script: SCRIPT_URL }) function cleanup() { Entities.deleteEntity(clockbodyEntity); Entities.deleteEntity(clockfaceEntity); } Script.scriptEnding.connect(cleanup);