whiteboard markers and erasers now spawn back at rack when they collide with home

This commit is contained in:
ericrius1 2016-04-05 15:01:08 -07:00
parent 9f60a4e05c
commit bd4e3b3460
4 changed files with 55 additions and 24 deletions

View file

@ -84,15 +84,20 @@
var otherProps = Entities.getEntityProperties(otherID);
if (otherProps.name === 'home_model_homeset') {
var userData = getEntityUserData(_this.entityID);
Entities.editEntity(_this.entityID) {
Entities.editEntity(_this.entityID, {
position: userData.originalPosition,
rotation: userData.originalRotation,
velocity: {
x: 0,
y: -0.01,
z: 0
},
angularVelocity: {
x: 0,
y: 0,
z: 0
}
}
});
}
},

View file

@ -67,34 +67,22 @@
visible: false
});
// Once user releases marker, wait a bit then put marker back to its original position and rotation
// Script.setTimeout(function() {
// var userData = getEntityUserData(_this.entityID);
// Entities.editEntity(_this.entityID, {
// position: userData.originalPosition,
// rotation: userData.originalRotation,
// velocity: {
// x: 0,
// y: -0.01,
// z: 0
// }
// });
// }, _this.MARKER_RESET_WAIT_TIME);
},
collisionWithEntity: function(myID, otherID, collision) {
var otherProps = Entities.getEntityProperties(otherID);
if (otherProps.name === 'home_model_homeset') {
var userData = getEntityUserData(_this.entityID);
Entities.editEntity(_this.entityID) {
Entities.editEntity(_this.entityID, {
position: userData.originalPosition,
rotation: userData.originalRotation,
velocity: {
x: 0,
y: -0.01,
z: 0
}
}
},
angularVelocity: {x: 0, y: 0, z: 0}
})
}
},
continueEquip: function() {

View file

@ -0,0 +1,12 @@
var whiteboardPath = Script.resolvePath('wrapper.js');
Script.include(whiteboardPath);
var whiteboard = new Whiteboard({
x: 1104,
y: 460.5,
z: -77
}, {
x: 0,
y: -133,
z: 0
});

View file

@ -25,8 +25,14 @@ Whiteboard = function(spawnPosition, spawnRotation) {
});
var whiteboardPosition = spawnPosition;
var whiteboardRotation = orientation;
var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx";
var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj";
// var WHITEBOARD_MODEL_URL = "atp:/whiteboard/Whiteboard-4.fbx";
// var WHITEBOARD_COLLISION_HULL_URL = "atp:/whiteboard/whiteboardCollisionHull.obj";
// EBL REMOVE ME
var WHITEBOARD_MODEL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/Whiteboard-4.fbx";
var WHITEBOARD_COLLISION_HULL_URL = "https://hifi-content.s3.amazonaws.com/eric/models/whiteboardCollisionHull.obj";
var whiteboard = Entities.addEntity({
type: "Model",
name: "home_model_whiteboard",
@ -92,8 +98,16 @@ Whiteboard = function(spawnPosition, spawnRotation) {
var WHITEBOARD_RACK_DEPTH = 1.9;
// ************ ERAAAAAAASSSEERRRR ************************************************
// ********************************************************************************
var ERASER_MODEL_URL = "atp:/whiteboard/eraser-2.fbx";
// EBL REMOVE ME
var ERASER_MODEL_URL = "https://s3.amazonaws.com/hifi-public/eric/models/eraser.fbx";
var eraserPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.5, Quat.getRight(whiteboardRotation)));
var eraserRotation = markerRotation;
@ -156,11 +170,23 @@ Whiteboard = function(spawnPosition, spawnRotation) {
}
// *************************************************************************************************
// *************************************************************************************************
// *************************************************************************************************
function createMarkers() {
// var modelURLS = [
// "atp:/whiteboard/marker-blue.fbx",
// "atp:/whiteboard/marker-red.fbx",
// "atp:/whiteboard/marker-black.fbx",
// ];
// EBL REMOVE ME
var modelURLS = [
"atp:/whiteboard/marker-blue.fbx",
"atp:/whiteboard/marker-red.fbx",
"atp:/whiteboard/marker-black.fbx",
"https://hifi-content.s3.amazonaws.com/eric/models/marker-black.fbx",
"https://hifi-content.s3.amazonaws.com/eric/models/marker-red.fbx",
"https://hifi-content.s3.amazonaws.com/eric/models/marker-blue.fbx",
];
var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
@ -196,7 +222,7 @@ Whiteboard = function(spawnPosition, spawnRotation) {
dynamic: true,
gravity: {
x: 0,
y: -10,
y: -5,
z: 0
},
velocity: {