mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 06:57:37 +02:00
whiteboard markers and erasers now spawn back at rack when they collide with home
This commit is contained in:
parent
9f60a4e05c
commit
bd4e3b3460
4 changed files with 55 additions and 24 deletions
|
@ -84,15 +84,20 @@
|
||||||
var otherProps = Entities.getEntityProperties(otherID);
|
var otherProps = Entities.getEntityProperties(otherID);
|
||||||
if (otherProps.name === 'home_model_homeset') {
|
if (otherProps.name === 'home_model_homeset') {
|
||||||
var userData = getEntityUserData(_this.entityID);
|
var userData = getEntityUserData(_this.entityID);
|
||||||
Entities.editEntity(_this.entityID) {
|
Entities.editEntity(_this.entityID, {
|
||||||
position: userData.originalPosition,
|
position: userData.originalPosition,
|
||||||
rotation: userData.originalRotation,
|
rotation: userData.originalRotation,
|
||||||
velocity: {
|
velocity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -0.01,
|
y: -0.01,
|
||||||
z: 0
|
z: 0
|
||||||
|
},
|
||||||
|
angularVelocity: {
|
||||||
|
x: 0,
|
||||||
|
y: 0,
|
||||||
|
z: 0
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -67,34 +67,22 @@
|
||||||
visible: false
|
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) {
|
collisionWithEntity: function(myID, otherID, collision) {
|
||||||
var otherProps = Entities.getEntityProperties(otherID);
|
var otherProps = Entities.getEntityProperties(otherID);
|
||||||
if (otherProps.name === 'home_model_homeset') {
|
if (otherProps.name === 'home_model_homeset') {
|
||||||
var userData = getEntityUserData(_this.entityID);
|
var userData = getEntityUserData(_this.entityID);
|
||||||
Entities.editEntity(_this.entityID) {
|
Entities.editEntity(_this.entityID, {
|
||||||
position: userData.originalPosition,
|
position: userData.originalPosition,
|
||||||
rotation: userData.originalRotation,
|
rotation: userData.originalRotation,
|
||||||
velocity: {
|
velocity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -0.01,
|
y: -0.01,
|
||||||
z: 0
|
z: 0
|
||||||
}
|
},
|
||||||
}
|
angularVelocity: {x: 0, y: 0, z: 0}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
continueEquip: function() {
|
continueEquip: function() {
|
||||||
|
|
|
@ -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
|
||||||
|
});
|
|
@ -25,8 +25,14 @@ Whiteboard = function(spawnPosition, spawnRotation) {
|
||||||
});
|
});
|
||||||
var whiteboardPosition = spawnPosition;
|
var whiteboardPosition = spawnPosition;
|
||||||
var whiteboardRotation = orientation;
|
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({
|
var whiteboard = Entities.addEntity({
|
||||||
type: "Model",
|
type: "Model",
|
||||||
name: "home_model_whiteboard",
|
name: "home_model_whiteboard",
|
||||||
|
@ -92,8 +98,16 @@ Whiteboard = function(spawnPosition, spawnRotation) {
|
||||||
|
|
||||||
var WHITEBOARD_RACK_DEPTH = 1.9;
|
var WHITEBOARD_RACK_DEPTH = 1.9;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// ************ ERAAAAAAASSSEERRRR ************************************************
|
||||||
|
// ********************************************************************************
|
||||||
var ERASER_MODEL_URL = "atp:/whiteboard/eraser-2.fbx";
|
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));
|
var eraserPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
|
||||||
eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.5, Quat.getRight(whiteboardRotation)));
|
eraserPosition = Vec3.sum(eraserPosition, Vec3.multiply(-0.5, Quat.getRight(whiteboardRotation)));
|
||||||
var eraserRotation = markerRotation;
|
var eraserRotation = markerRotation;
|
||||||
|
@ -156,11 +170,23 @@ Whiteboard = function(spawnPosition, spawnRotation) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// *************************************************************************************************
|
||||||
|
// *************************************************************************************************
|
||||||
|
// *************************************************************************************************
|
||||||
|
|
||||||
function createMarkers() {
|
function createMarkers() {
|
||||||
|
// var modelURLS = [
|
||||||
|
// "atp:/whiteboard/marker-blue.fbx",
|
||||||
|
// "atp:/whiteboard/marker-red.fbx",
|
||||||
|
// "atp:/whiteboard/marker-black.fbx",
|
||||||
|
// ];
|
||||||
|
|
||||||
|
|
||||||
|
// EBL REMOVE ME
|
||||||
var modelURLS = [
|
var modelURLS = [
|
||||||
"atp:/whiteboard/marker-blue.fbx",
|
"https://hifi-content.s3.amazonaws.com/eric/models/marker-black.fbx",
|
||||||
"atp:/whiteboard/marker-red.fbx",
|
"https://hifi-content.s3.amazonaws.com/eric/models/marker-red.fbx",
|
||||||
"atp:/whiteboard/marker-black.fbx",
|
"https://hifi-content.s3.amazonaws.com/eric/models/marker-blue.fbx",
|
||||||
];
|
];
|
||||||
var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
|
var markerPosition = Vec3.sum(spawnPosition, Vec3.multiply(Quat.getFront(whiteboardRotation), -0.1));
|
||||||
|
|
||||||
|
@ -196,7 +222,7 @@ Whiteboard = function(spawnPosition, spawnRotation) {
|
||||||
dynamic: true,
|
dynamic: true,
|
||||||
gravity: {
|
gravity: {
|
||||||
x: 0,
|
x: 0,
|
||||||
y: -10,
|
y: -5,
|
||||||
z: 0
|
z: 0
|
||||||
},
|
},
|
||||||
velocity: {
|
velocity: {
|
||||||
|
|
Loading…
Reference in a new issue