marker only draws when equipped and held down

This commit is contained in:
ericrius1 2016-02-23 09:53:20 -08:00
parent 69dc9ef68f
commit b5ec79fd6d

View file

@ -13,7 +13,10 @@
(function() {
Script.include("../../libraries/utils.js");
var TRIGGER_CONTROLS = [
Controller.Standard.LT,
Controller.Standard.RT,
];
var MAX_POINTS_PER_STROKE = 40;
var _this;
MarkerTip = function() {
@ -30,21 +33,25 @@ var _this;
MarkerTip.prototype = {
continueNearGrab: function() {
_this.continueHolding();
startEquip: function(id, params) {
_this.equipped = true;
_this.hand = params[0] == "left" ? 0 : 1;
},
continueEquip: function() {
this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[_this.hand]);
if (_this.triggerValue > 0.2) {
print("EBL PAINZT");
_this.continueHolding();
} else {
_this.currentStroke = null;
}
},
continueHolding: function() {
// cast a ray from marker and see if it hits anything
var markerProps = Entities.getEntityProperties(_this.entityID, ["position", "rotation"]);
var pickRay = {
origin: markerProps.position,
direction: Quat.getFront(markerProps.rotation)