From 56f335bb65a072e1e0740d5a01100f9638ab8b5d Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 29 Jul 2014 11:51:24 -0700 Subject: [PATCH] Make sure models are in range before adding them --- examples/sit.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/sit.js b/examples/sit.js index c157d4854d..793a1b1d67 100644 --- a/examples/sit.js +++ b/examples/sit.js @@ -274,7 +274,10 @@ function update(deltaTime){ for (var i = 0; i < foundModels.length; ++i) { var model = foundModels[i]; if (typeof(models[model.id]) == "undefined") { - addIndicators(model); + model.properties = Models.getModelProperties(model); + if (Vec3.distance(model.properties.position, MyAvatar.position) < SEARCH_RADIUS) { + addIndicators(model); + } } } @@ -285,7 +288,6 @@ function update(deltaTime){ } function addIndicators(modelID) { - modelID.properties = Models.getModelProperties(modelID); if (modelID.properties.sittingPoints.length > 0) { for (var i = 0; i < modelID.properties.sittingPoints.length; ++i) { modelID.properties.sittingPoints[i].indicator = new SeatIndicator(modelID.properties, i);