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) {
var transformerProps = {
name: 'hifi-home-dressing-room-little-transformer',
type: 'model',
position: spawnPosition,
rotation: spawnRotation,
modelURL: modelURL,
dynamic: true,
gravity: {
x: 0,
y: -5,
z: 0
},
userData: JSON.stringify({
'grabbableKey': {
'grabbable:', true
},
'hifiHomeTransformerKey': {
'basePosition': spawnPosition
},
'hifiHomeKey': {
'reset': true
}
}),
}
Entities.addEntity(transformerProps);
return this;
}
TransformerDoll = function(modelURL, spawnPosition, spawnRotation) {
var TRANSFORMER_SCRIPT = Script.resolvePath('transformer.js?' + Math.random());
var transformerProps = {
name: 'hifi-home-dressing-room-little-transformer',
type: 'model',
position: spawnPosition,
rotation: spawnRotation,
modelURL: modelURL,
dynamic: true,
gravity: {
x: 0,
y: -5,
z: 0
},
userData: JSON.stringify({
'grabbableKey': {
'grabbable': true
},
'hifiHomeTransformerKey': {
'basePosition': spawnPosition
},
'hifiHomeKey': {
'reset': true
}
}),
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(tiltMazePath);
Script.include(whiteboardPath);
Script.include(plantPath);
// Script.include(plantPath);
Script.include(cuckooClockPath);
Script.include(pingPongGunPath);
Script.include(transformerPath);
@ -149,15 +149,15 @@
z: 0
});
var myPlant = new Plant({
x: 1099.8785,
y: 460.3115,
z: -84.7736
}, {
x: 0,
y: 0,
z: 0
});
// var myPlant = new Plant({
// x: 1099.8785,
// y: 460.3115,
// z: -84.7736
// }, {
// x: 0,
// y: 0,
// z: 0
// });
var pingPongGun = new HomePingPongGun({
x: 1101.2123,
@ -268,6 +268,7 @@
},
createTransformers: function() {
print('CREATING TRANSFORMERS!')
var firstDollPosition= {
x: 1108.2123,
y: 460.7516,
@ -296,6 +297,7 @@
var howFarLeft = Vec3.multiply(separation, left);
var distanceToLeft = Vec3.sum(firstDollPosition, howFarLeft);
var transformer = new TransformerDoll(doll, distanceToLeft, dollRotation);
print('CREATE TRANSFORMER:: '+ doll)
});
},