only show overlay if within painting range

This commit is contained in:
ericrius1 2016-02-23 16:49:03 -08:00
parent d1d4a9d6b1
commit 0b569a0fab

View file

@ -58,13 +58,14 @@
direction: Quat.getFront(markerProps.rotation) direction: Quat.getFront(markerProps.rotation)
} }
var intersection = Entities.findRayIntersection(pickRay, true, [_this.whiteboard]); var intersection = Entities.findRayIntersection(pickRay, true, [_this.whiteboard]);
if (intersection.intersects) {
if (intersection.intersects && Vec3.distance(intersection.intersection, markerProps.position) < _this.MAX_MARKER_TO_BOARD_DISTANCE) {
Overlays.editOverlay(_this.laserPointer, { Overlays.editOverlay(_this.laserPointer, {
visible: true, visible: true,
position: intersection.intersection position: intersection.intersection
}) })
_this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[_this.hand]); _this.triggerValue = Controller.getValue(TRIGGER_CONTROLS[_this.hand]);
if (_this.triggerValue > _this.PAINTING_TRIGGER_THRESHOLD && Vec3.distance(intersection.intersection, markerProps.position) < _this.MAX_MARKER_TO_BOARD_DISTANCE) { if (_this.triggerValue > _this.PAINTING_TRIGGER_THRESHOLD) {
_this.paint(intersection.intersection) _this.paint(intersection.intersection)
} else { } else {
_this.resetStroke(); _this.resetStroke();
@ -91,7 +92,7 @@
position: position, position: position,
textures: _this.MARKER_TEXTURE_URL, textures: _this.MARKER_TEXTURE_URL,
color: _this.markerColor, color: _this.markerColor,
lifetime: 1000 lifetime: 200
}); });
_this.linePoints = []; _this.linePoints = [];
@ -149,6 +150,9 @@
unload: function() { unload: function() {
Overlays.deleteOverlay(_this.laserPointer); Overlays.deleteOverlay(_this.laserPointer);
_this.strokes.forEach( function(stroke) {
Entities.deleteEntity(stroke);
});
}, },
setProperties: function(myId, data) { setProperties: function(myId, data) {