update toys to be inverted while held

This commit is contained in:
James B. Pollack 2015-12-03 11:10:22 -08:00
parent 65334659ae
commit cf5c8c08e2
3 changed files with 40 additions and 9 deletions

View file

@ -15,12 +15,20 @@ function createDoll() {
var scriptURL = Script.resolvePath("doll.js");
var center = Vec3.sum(Vec3.sum(MyAvatar.position, { x: 0, y: 0.5, z: 0 }), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,
y: 0.5,
z: 0
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
var naturalDimensions = { x: 1.63, y: 1.67, z: 0.26};
var naturalDimensions = {
x: 1.63,
y: 1.67,
z: 0.26
};
var desiredDimensions = Vec3.multiply(naturalDimensions, 0.15);
var doll = Entities.addEntity({
type: "Model",
name: "doll",
@ -39,7 +47,12 @@ function createDoll() {
y: 0,
z: 0
},
collisionsWillMove: true
collisionsWillMove: true,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
}
})
});
return doll;
}

View file

@ -18,14 +18,27 @@ var scriptURL = Script.resolvePath('flashlight.js');
var modelURL = "https://hifi-public.s3.amazonaws.com/models/props/flashlight.fbx";
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {x: 0, y: 0.5, z: 0}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
var center = Vec3.sum(Vec3.sum(MyAvatar.position, {
x: 0,
y: 0.5,
z: 0
}), Vec3.multiply(0.5, Quat.getFront(Camera.getOrientation())));
var flashlight = Entities.addEntity({
type: "Model",
modelURL: modelURL,
position: center,
dimensions: { x: 0.08, y: 0.30, z: 0.08},
dimensions: {
x: 0.08,
y: 0.30,
z: 0.08
},
collisionsWillMove: true,
shapeType: 'box',
script: scriptURL
});
script: scriptURL,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
}
})
});

View file

@ -35,7 +35,12 @@ var pingPongGun = Entities.addEntity({
z: 0.47
},
collisionsWillMove: true,
collisionSoundURL: COLLISION_SOUND_URL
collisionSoundURL: COLLISION_SOUND_URL,
userData: JSON.stringify({
grabbableKey: {
invertSolidWhileHeld: true
}
})
});
function cleanUp() {