diff --git a/libraries/entities-renderer/src/EntityTreeRenderer.cpp b/libraries/entities-renderer/src/EntityTreeRenderer.cpp index fb6054a514..31284b2f69 100644 --- a/libraries/entities-renderer/src/EntityTreeRenderer.cpp +++ b/libraries/entities-renderer/src/EntityTreeRenderer.cpp @@ -608,7 +608,6 @@ RayToEntityIntersectionResult EntityTreeRenderer::findRayIntersectionWorker(cons (void**)&intersectedEntity, lockType, &result.accurate); if (result.intersects && intersectedEntity) { result.entityID = intersectedEntity->getEntityItemID(); - result.properties = intersectedEntity->getProperties(); result.intersection = ray.origin + (ray.direction * result.distance); result.entity = intersectedEntity; } @@ -704,7 +703,9 @@ void EntityTreeRenderer::mousePressEvent(QMouseEvent* event) { if (rayPickResult.intersects) { //qCDebug(entitiesrenderer) << "mousePressEvent over entity:" << rayPickResult.entityID; - QString urlString = rayPickResult.properties.getHref(); + auto entity = getTree()->findEntityByEntityItemID(rayPickResult.entityID); + auto properties = entity->getProperties(); + QString urlString = properties.getHref(); QUrl url = QUrl(urlString, QUrl::StrictMode); if (url.isValid() && !url.isEmpty()){ DependencyManager::get()->handleLookupString(urlString); @@ -750,12 +751,6 @@ void EntityTreeRenderer::mouseDoublePressEvent(QMouseEvent* event) { if (rayPickResult.intersects) { //qCDebug(entitiesrenderer) << "mouseDoublePressEvent over entity:" << rayPickResult.entityID; - QString urlString = rayPickResult.properties.getHref(); - QUrl url = QUrl(urlString, QUrl::StrictMode); - if (url.isValid() && !url.isEmpty()){ - DependencyManager::get()->handleLookupString(urlString); - } - glm::vec2 pos2D = projectOntoEntityXYPlane(rayPickResult.entity, ray, rayPickResult); PointerEvent pointerEvent(PointerEvent::Press, MOUSE_POINTER_ID, pos2D, rayPickResult.intersection, diff --git a/libraries/entities/src/EntityScriptingInterface.cpp b/libraries/entities/src/EntityScriptingInterface.cpp index 1ab5438e53..1dded10302 100644 --- a/libraries/entities/src/EntityScriptingInterface.cpp +++ b/libraries/entities/src/EntityScriptingInterface.cpp @@ -673,7 +673,6 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorke (void**)&intersectedEntity, lockType, &result.accurate); if (result.intersects && intersectedEntity) { result.entityID = intersectedEntity->getEntityItemID(); - result.properties = intersectedEntity->getProperties(); result.intersection = ray.origin + (ray.direction * result.distance); } } @@ -838,7 +837,6 @@ RayToEntityIntersectionResult::RayToEntityIntersectionResult() : intersects(false), accurate(true), // assume it's accurate entityID(), - properties(), distance(0), face(), entity(NULL) @@ -854,9 +852,6 @@ QScriptValue RayToEntityIntersectionResultToScriptValue(QScriptEngine* engine, c QScriptValue entityItemValue = EntityItemIDtoScriptValue(engine, value.entityID); obj.setProperty("entityID", entityItemValue); - QScriptValue propertiesValue = EntityItemPropertiesToScriptValue(engine, value.properties); - obj.setProperty("properties", propertiesValue); - obj.setProperty("distance", value.distance); QString faceName = ""; @@ -902,10 +897,6 @@ void RayToEntityIntersectionResultFromScriptValue(const QScriptValue& object, Ra QScriptValue entityIDValue = object.property("entityID"); // EntityItemIDfromScriptValue(entityIDValue, value.entityID); quuidFromScriptValue(entityIDValue, value.entityID); - QScriptValue entityPropertiesValue = object.property("properties"); - if (entityPropertiesValue.isValid()) { - EntityItemPropertiesFromScriptValueHonorReadOnly(entityPropertiesValue, value.properties); - } value.distance = object.property("distance").toVariant().toFloat(); QString faceName = object.property("face").toVariant().toString(); diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index 63b5771e60..630c55e4e2 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -58,7 +58,6 @@ public: bool intersects; bool accurate; QUuid entityID; - EntityItemProperties properties; float distance; BoxFace face; glm::vec3 intersection; diff --git a/script-archive/example/games/grabHockey.js b/script-archive/example/games/grabHockey.js index 961a8af6ad..3f2a2fcf91 100644 --- a/script-archive/example/games/grabHockey.js +++ b/script-archive/example/games/grabHockey.js @@ -142,7 +142,8 @@ function mousePressEvent(event) { if (!pickResults.intersects) { return; } - if (pickResults.properties.dynamic) { + var isDynamic = Entites.getEntityProperties(pickResults.entityID, "dynamic").dynamic; + if (isDynamic) { grabbedEntity = pickResults.entityID; var props = Entities.getEntityProperties(grabbedEntity) originalGravity = props.gravity; diff --git a/script-archive/example/games/hydraGrabHockey.js b/script-archive/example/games/hydraGrabHockey.js index e7d6746309..e357735fe5 100644 --- a/script-archive/example/games/hydraGrabHockey.js +++ b/script-archive/example/games/hydraGrabHockey.js @@ -190,7 +190,10 @@ function controller(side) { direction: Vec3.normalize(Vec3.subtract(this.tipPosition, this.palmPosition)) }; var intersection = getRayIntersection(pickRay, true); - if (intersection.intersects && intersection.properties.dynamic) { + + var isDynamic = Entites.getEntityProperties(intersection.entityID, "dynamic").dynamic; + + if (intersection.intersects && isDynamic) { this.laserWasHovered = true; if (this.triggerHeld && !this.grabbing) { this.grab(intersection.entityID); diff --git a/script-archive/example/scripts/rayPickExample.js b/script-archive/example/scripts/rayPickExample.js index d85138211e..3687176af1 100644 --- a/script-archive/example/scripts/rayPickExample.js +++ b/script-archive/example/scripts/rayPickExample.js @@ -38,7 +38,6 @@ function mouseMoveEvent(event) { if (intersection.intersects) { print("intersection entityID=" + intersection.entityID); - print("intersection properties.modelURL=" + intersection.properties.modelURL); print("intersection face=" + intersection.face); print("intersection distance=" + intersection.distance); print("intersection intersection.x/y/z=" + intersection.intersection.x + ", " diff --git a/script-archive/painting/whiteboard/whiteboardEntityScript.js b/script-archive/painting/whiteboard/whiteboardEntityScript.js index 181932c7cb..01497b406d 100644 --- a/script-archive/painting/whiteboard/whiteboardEntityScript.js +++ b/script-archive/painting/whiteboard/whiteboardEntityScript.js @@ -77,6 +77,8 @@ //Comment out above line and uncomment below line to see difference in performance between using a whitelist, and not using one // this.intersection = Entities.findRayIntersection(pickRay, true); + var type = Entites.getEntityProperties(this.intersection.entityID, "type").type; + if (this.intersection.intersects) { var distance = Vec3.distance(handPosition, this.intersection.intersection); if (distance < MAX_DISTANCE) { @@ -98,7 +100,7 @@ this.oldPosition = null; } } - } else if (this.intersection.properties.type !== "Unknown") { + } else if (type !== "Unknown") { //Sometimes ray will pick against an invisible object with type unkown... so if type is unknown, ignore this.stopPainting(); } diff --git a/script-archive/vrShop/item/shopItemGrab.js b/script-archive/vrShop/item/shopItemGrab.js index a7226675eb..2b63ca1b53 100644 --- a/script-archive/vrShop/item/shopItemGrab.js +++ b/script-archive/vrShop/item/shopItemGrab.js @@ -382,7 +382,10 @@ function MyController(hand) { var grabbableData = getEntityCustomData(GRABBABLE_DATA_KEY, intersection.entityID, DEFAULT_GRABBABLE_DATA); - if (intersection.properties.name == "Grab Debug Entity") { + var properties = Entites.getEntityProperties(intersection.entityID, ["locked", "name"]); + + + if (properties.name == "Grab Debug Entity") { continue; } @@ -399,7 +402,7 @@ function MyController(hand) { this.grabbedEntity = intersection.entityID; this.setState(STATE_NEAR_TRIGGER); return; - } else if (!intersection.properties.locked) { + } else if (!properties.locked) { var ownerObj = getEntityCustomData('ownerKey', intersection.entityID, null); if (ownerObj == null || ownerObj.ownerID === MyAvatar.sessionUUID) { //I can only grab new or already mine items diff --git a/scripts/system/controllers/grab.js b/scripts/system/controllers/grab.js index 05b2eefeb5..10f477b3af 100644 --- a/scripts/system/controllers/grab.js +++ b/scripts/system/controllers/grab.js @@ -343,7 +343,8 @@ Grabber.prototype.pressEvent = function(event) { return; } - if (!pickResults.properties.dynamic) { + var isDynamic = Entities.getEntityProperties(pickResults.entityID, "dynamic").dynamic; + if (!isDynamic) { // only grab dynamic objects return; } diff --git a/scripts/tutorials/entity_scripts/pistol.js b/scripts/tutorials/entity_scripts/pistol.js index 38eb929177..1a570cc80f 100644 --- a/scripts/tutorials/entity_scripts/pistol.js +++ b/scripts/tutorials/entity_scripts/pistol.js @@ -151,8 +151,9 @@ }); }, randFloat(10, 200)); } - if (intersection.properties.dynamic === 1) { - // Any dynaic entity can be shot + var isDynamic = Entities.getEntityProperties(intersection.entityID, "dynamic").dynamic; + if (isDynamic === 1) { + // Any dynamic entity can be shot Entities.editEntity(intersection.entityID, { velocity: Vec3.multiply(this.firingDirection, this.bulletForce) }); @@ -347,7 +348,7 @@ this.laser = Overlays.addOverlay("line3d", { start: ZERO_VECTOR, end: ZERO_VECTOR, - color: COLORS.RED, + color: { red: 255, green: 0, blue: 0}, alpha: 1, visible: true, lineWidth: 2