have breakdance entity script use the model and location of the entity

This commit is contained in:
Brad Hefta-Gaub 2015-09-04 16:20:12 -07:00
parent 66bd59b142
commit 10585a1b30
2 changed files with 13 additions and 6 deletions

View file

@ -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();

View file

@ -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) {