From 10585a1b30224a6bb45e87a1d09b415e72630944 Mon Sep 17 00:00:00 2001 From: Brad Hefta-Gaub Date: Fri, 4 Sep 2015 16:20:12 -0700 Subject: [PATCH] have breakdance entity script use the model and location of the entity --- examples/entityScripts/breakdanceEntity.js | 3 ++- examples/toys/breakdanceCore.js | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/entityScripts/breakdanceEntity.js b/examples/entityScripts/breakdanceEntity.js index 77980c0d13..40918bd65f 100644 --- a/examples/entityScripts/breakdanceEntity.js +++ b/examples/entityScripts/breakdanceEntity.js @@ -49,7 +49,8 @@ if (!_this.beingGrabbed) { // remember we're being grabbed so we can detect being released _this.beingGrabbed = true; - breakdanceStart(); + var props = Entities.getEntityProperties(entityID); + breakdanceStart(props.modelURL, props.position); print("I'm was grabbed..."); } else { breakdanceUpdate(); diff --git a/examples/toys/breakdanceCore.js b/examples/toys/breakdanceCore.js index 9bf63850ab..dd7f989c1c 100644 --- a/examples/toys/breakdanceCore.js +++ b/examples/toys/breakdanceCore.js @@ -358,13 +358,19 @@ var NATURAL_DIMENSIONS = { x: 1.63, y: 1.67, z: 0.31 }; var DIMENSIONS = Vec3.multiply(NATURAL_DIMENSIONS, 0.3); var puppetEntityID; -function createPuppet() { +function createPuppet(model, location) { + if (model === undefined) { + model = "https://hifi-public.s3.amazonaws.com/models/Bboys/bboy1/bboy1.fbx"; + } + if (location == undefined) { + location = getPositionPuppet(); + } puppetEntityID = Entities.addEntity({ type: "Model", - modelURL: "https://hifi-public.s3.amazonaws.com/models/Bboys/bboy1/bboy1.fbx", + modelURL: model, animationURL: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_ready.fbx", animationSettings: ANIMATION_SETTINGS, - position: getPositionPuppet(), + position: location, ignoreForCollisions: true, dimensions: DIMENSIONS, lifetime: TEMPORARY_LIFETIME @@ -452,10 +458,10 @@ poses[LEFT_SIDE + RIGHT_FRONT ] = { name: "Left Side + Right Front", poses[LEFT_FRONT + RIGHT_FRONT ] = { name: "Left Front + Right Front", animation: "http://s3.amazonaws.com/hifi-public/animations/Breakdancing/breakdance_uprock_var_1_end.fbx" }; -breakdanceStart = function() { +breakdanceStart = function(model, location) { print("breakdanceStart..."); createOverlays(); - createPuppet(); + createPuppet(model, location); } breakdanceUpdate = function(deltaTime) {