From 7f23ee04be9995f11b55731c48103ddcada0315b Mon Sep 17 00:00:00 2001 From: ericrius1 Date: Wed, 17 Feb 2016 17:16:43 -0800 Subject: [PATCH] basic marker entity script --- .../whiteboardV2/markerEntityScript.js | 35 +++++++++++++++++++ .../whiteboardV2/whiteboardSpawner.js | 12 ++----- 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 examples/homeContent/whiteboardV2/markerEntityScript.js diff --git a/examples/homeContent/whiteboardV2/markerEntityScript.js b/examples/homeContent/whiteboardV2/markerEntityScript.js new file mode 100644 index 0000000000..43a7ec1788 --- /dev/null +++ b/examples/homeContent/whiteboardV2/markerEntityScript.js @@ -0,0 +1,35 @@ +// +// markerTipEntityScript.js +// examples/homeContent/markerTipEntityScript +// +// Created by Eric Levin on 2/17/15. +// Copyright 2016 High Fidelity, Inc. +// + +// 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("../../libraries/utils.js"); + + MarkerTip = function() { + _this = this; + }; + + MarkerTip.prototype = { + + continueNearGrab: function() { + print("EBL Conintue ") + }, + + preload: function(entityID) { + this.entityID = entityID; + + } + }; + + // entity scripts always need to return a newly constructed object of our type + return new MarkerTip(); +}); diff --git a/examples/homeContent/whiteboardV2/whiteboardSpawner.js b/examples/homeContent/whiteboardV2/whiteboardSpawner.js index 4a1a89c250..a699bcafa2 100644 --- a/examples/homeContent/whiteboardV2/whiteboardSpawner.js +++ b/examples/homeContent/whiteboardV2/whiteboardSpawner.js @@ -41,6 +41,7 @@ var whiteboard = Entities.addEntity({ var markerPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.9, Quat.getFront(orientation))); var MARKER_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/marker-blue.fbx"; +var MARKER_SCRIPT_URL = Script.resolvePath("markerEntityScript.js?v1" + Math.random()); var marker = Entities.addEntity({ type: "Model", modelURL: MARKER_MODEL_URL, @@ -51,7 +52,6 @@ var marker = Entities.addEntity({ y: -1, z: 0 }, - // rotation: whiteboardRotation, velocity: { x: 0, y: -0.1, @@ -63,6 +63,7 @@ var marker = Entities.addEntity({ y: 0.0272, z: 0.1641 }, + script: MARKER_SCRIPT_URL, userData: JSON.stringify({ wearable: { joints: { @@ -91,20 +92,11 @@ var marker = Entities.addEntity({ }) }); -var markerTip = Entities.addEntity({ - type: "Box", - dimensions: {x: 0.05, y: 0.05, z: 0.05}, - position: Vec3.sum(markerPosition, {x: 0.0, y: 0.001, z: 0.1}), - parentID: marker, - color: {red: 200, green: 10, blue: 200}, - collisionless: true -}) function cleanup() { Entities.deleteEntity(whiteboard); Entities.deleteEntity(marker); - Entities.deleteEntity(markerTip); } Script.scriptEnding.connect(cleanup); \ No newline at end of file