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,28 +1,39 @@
function TransformerDoll(modelURL, spawnPosition, spawnRotation) { TransformerDoll = function(modelURL, spawnPosition, spawnRotation) {
var transformerProps = {
name: 'hifi-home-dressing-room-little-transformer', var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js?' + Math.random());
type: 'model', var transformerProps = {
position: spawnPosition, name: 'hifi-home-dressing-room-little-transformer',
rotation: spawnRotation, type: 'model',
modelURL: modelURL, position: spawnPosition,
dynamic: true, rotation: spawnRotation,
gravity: { modelURL: modelURL,
x: 0, dynamic: true,
y: -5, gravity: {
z: 0 x: 0,
}, y: -5,
userData: JSON.stringify({ z: 0
'grabbableKey': { },
'grabbable:', true userData: JSON.stringify({
}, 'grabbableKey': {
'hifiHomeTransformerKey': { 'grabbable': true
'basePosition': spawnPosition },
}, 'hifiHomeTransformerKey': {
'hifiHomeKey': { 'basePosition': spawnPosition
'reset': true },
} 'hifiHomeKey': {
}), 'reset': true
} }
Entities.addEntity(transformerProps); }),
return this; script: TRANSFORMER_SCRIPT
} }
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;
}

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)
}); });
}, },