only erase stroke map on release and preload

This commit is contained in:
ericrius1 2016-02-25 15:00:54 -08:00
parent 4de951242c
commit ddae2d4f74
2 changed files with 6 additions and 5 deletions

View file

@ -24,6 +24,7 @@
_this.ERASER_TRIGGER_THRESHOLD = 0.2; _this.ERASER_TRIGGER_THRESHOLD = 0.2;
_this.STROKE_NAME = "hifi-marker-stroke"; _this.STROKE_NAME = "hifi-marker-stroke";
_this.ERASER_TO_STROKE_SEARCH_RADIUS = 0.7; _this.ERASER_TO_STROKE_SEARCH_RADIUS = 0.7;
_this.strokeMap = [];
}; };
Eraser.prototype = { Eraser.prototype = {
@ -35,10 +36,10 @@
var eraserPosition = Entities.getEntityProperties(_this.entityID, "position").position; var eraserPosition = Entities.getEntityProperties(_this.entityID, "position").position;
var strokeIDs = Entities.findEntities(eraserPosition, _this.ERASER_TO_STROKE_SEARCH_RADIUS); var strokeIDs = Entities.findEntities(eraserPosition, _this.ERASER_TO_STROKE_SEARCH_RADIUS);
// Create a map of stroke entities and their positions // Create a map of stroke entities and their positions
_this.strokeMap = [];
strokeIDs.forEach(function(strokeID) { strokeIDs.forEach(function(strokeID) {
var strokeProps = Entities.getEntityProperties(strokeID, ["position", "name"]); var strokeProps = Entities.getEntityProperties(strokeID, ["position", "name"]);
if (strokeProps.name === _this.STROKE_NAME) { if (strokeProps.name === _this.STROKE_NAME) {
_this.strokeMap.push({ _this.strokeMap.push({
strokeID: strokeID, strokeID: strokeID,
strokePosition: strokeProps.position strokePosition: strokeProps.position
@ -53,7 +54,9 @@
} else {} } else {}
}, },
releaseEquip: function() {}, releaseEquip: function() {
_this.strokeMap = [];
},
continueHolding: function() { continueHolding: function() {

View file

@ -149,8 +149,6 @@ function createMarkers() {
blue: 200 blue: 200
}); });
markerPosition = Vec3.sum(markerPosition, Vec3.multiply(-0.2, Quat.getFront(markerRotation))); markerPosition = Vec3.sum(markerPosition, Vec3.multiply(-0.2, Quat.getFront(markerRotation)));
createMarker(modelURLS[1], markerPosition, { createMarker(modelURLS[1], markerPosition, {
red: 200, red: 200,