refactoring

This commit is contained in:
ericrius1 2016-02-18 15:23:32 -08:00
parent 728e8c763d
commit 39d4fbf19d
2 changed files with 14 additions and 33 deletions

View file

@ -13,7 +13,7 @@
(function() {
Script.include("../../libraries/utils.js");
MarkerTip = function() {
_this = this;
};
@ -22,22 +22,29 @@
continueNearGrab: function() {
_this.continueHolding();
},
continueEquip: function() {
_this.continueHolding();
},
continueHolding: function() {
// cast a ray from marker and see if it hits anything
var props = Entities.getEntityProperties(_this.entityID, ["position", "rotation"]);
var pickRay = {
origin: props.position,
origin: props.position,
direction: Quat.getFront(props.rotation)
}
var intersection = Entities.findRayIntersection(pickRay, true);
if (intersection.intersects) {
print("INTERSECTION!")
}
},
preload: function(entityID) {
this.entityID = entityID;
}
@ -45,4 +52,4 @@
// entity scripts always need to return a newly constructed object of our type
return new MarkerTip();
});
});

View file

@ -40,7 +40,7 @@ var whiteboard = Entities.addEntity({
});
var markerPosition = Vec3.sum(MyAvatar.position, Vec3.multiply(1.9, Quat.getFront(orientation)));
var MARKER_MODEL_URL = "http://hifi-content.s3.amazonaws.com/alan/dev/marker-blue.fbx";
var MARKER_MODEL_URL = "https://s3-us-west-1.amazonaws.com/hifi-content/eric/models/marker-blue.fbx";
var MARKER_SCRIPT_URL = Script.resolvePath("markerEntityScript.js?v1" + Math.random());
var marker = Entities.addEntity({
type: "Model",
@ -63,33 +63,7 @@ var marker = Entities.addEntity({
y: 0.0272,
z: 0.1641
},
script: MARKER_SCRIPT_URL,
userData: JSON.stringify({
wearable: {
joints: {
RightHand: [{
"x": 0.03257002681493759,
"y": 0.15036098659038544,
"z": 0.051217660307884216
}, {
"x": -0.5274277329444885,
"y": -0.23446641862392426,
"z": -0.05400913953781128,
"w": 0.8148180246353149
}],
LeftHand: [{
"x": -0.031699854880571365,
"y": 0.15150733292102814,
"z": 0.041107177734375
}, {
"x": 0.649201512336731,
"y": 0.1007731482386589,
"z": 0.3215889632701874,
"w": -0.6818817853927612
}]
}
}
})
script: MARKER_SCRIPT_URL
});