This commit is contained in:
James B. Pollack 2016-03-27 12:59:57 -07:00
parent 75016be64e
commit 19e7b19533
2 changed files with 51 additions and 38 deletions

View file

@ -1,4 +1,6 @@
function TransformerDoll(modelURL, spawnPosition, spawnRotation) { TransformerDoll = function(modelURL, spawnPosition, spawnRotation) {
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js?' + Math.random());
var transformerProps = { var transformerProps = {
name: 'hifi-home-dressing-room-little-transformer', name: 'hifi-home-dressing-room-little-transformer',
type: 'model', type: 'model',
@ -13,7 +15,7 @@ function TransformerDoll(modelURL, spawnPosition, spawnRotation) {
}, },
userData: JSON.stringify({ userData: JSON.stringify({
'grabbableKey': { 'grabbableKey': {
'grabbable:', true 'grabbable': true
}, },
'hifiHomeTransformerKey': { 'hifiHomeTransformerKey': {
'basePosition': spawnPosition 'basePosition': spawnPosition
@ -22,7 +24,16 @@ function TransformerDoll(modelURL, spawnPosition, spawnRotation) {
'reset': true 'reset': true
} }
}), }),
script: TRANSFORMER_SCRIPT
} }
Entities.addEntity(transformerProps); var transformer = Entities.addEntity(transformerProps);
Script.setTimeout(function() {
var actualProps = Entities.getEntityProperties(transformer);
var quarterSize = Vec3.multiply(0.25, actualProps.naturalDimensions);
Entities.editEntity(transformer, {
dimensions: quarterSize
});
}, 1500)
return this; return this;
} }

View file

@ -43,7 +43,7 @@
Script.include(fishTankPath); Script.include(fishTankPath);
Script.include(tiltMazePath); Script.include(tiltMazePath);
Script.include(whiteboardPath); Script.include(whiteboardPath);
Script.include(plantPath); // Script.include(plantPath);
Script.include(cuckooClockPath); Script.include(cuckooClockPath);
Script.include(pingPongGunPath); Script.include(pingPongGunPath);
Script.include(transformerPath); Script.include(transformerPath);
@ -149,15 +149,15 @@
z: 0 z: 0
}); });
var myPlant = new Plant({ // var myPlant = new Plant({
x: 1099.8785, // x: 1099.8785,
y: 460.3115, // y: 460.3115,
z: -84.7736 // z: -84.7736
}, { // }, {
x: 0, // x: 0,
y: 0, // y: 0,
z: 0 // z: 0
}); // });
var pingPongGun = new HomePingPongGun({ var pingPongGun = new HomePingPongGun({
x: 1101.2123, x: 1101.2123,
@ -268,6 +268,7 @@
}, },
createTransformers: function() { createTransformers: function() {
print('CREATING TRANSFORMERS!')
var firstDollPosition= { var firstDollPosition= {
x: 1108.2123, x: 1108.2123,
y: 460.7516, y: 460.7516,
@ -296,6 +297,7 @@
var howFarLeft = Vec3.multiply(separation, left); var howFarLeft = Vec3.multiply(separation, left);
var distanceToLeft = Vec3.sum(firstDollPosition, howFarLeft); var distanceToLeft = Vec3.sum(firstDollPosition, howFarLeft);
var transformer = new TransformerDoll(doll, distanceToLeft, dollRotation); var transformer = new TransformerDoll(doll, distanceToLeft, dollRotation);
print('CREATE TRANSFORMER:: '+ doll)
}); });
}, },