Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 11 files). Show all
Unified · Split
| @@ -204,8 +204,7 @@ EntityItemID EntityScriptingInterface::findClosestEntity(const glm::vec3& center · 203 unmodified lines | ||
| 204 | 204 | const EntityItem* closestEntity = _entityTree->findClosestEntity(center, radius); |
| 205 | 205 | _entityTree->unlock(); |
| 206 | 206 | if (closestEntity) { |
| 207 | − result.id = closestEntity->getID(); | |
| 208 | − result.isKnownID = true; | |
| 207 | + result = closestEntity->getEntityItemID(); | |
| 209 | 208 | } |
| 210 | 209 | } |
| 211 | 210 | return result; |
| @@ -227,10 +226,25 @@ QVector<EntityItemID> EntityScriptingInterface::findEntities(const glm::vec3& ce · 15 unmodified lines | ||
| 227 | 226 | QVector<const EntityItem*> entities; |
| 228 | 227 | _entityTree->findEntities(center, radius, entities); |
| 229 | 228 | _entityTree->unlock(); |
| 229 | + | |
| 230 | + foreach (const EntityItem* entity, entities) { | |
| 231 | + result << entity->getEntityItemID(); | |
| 232 | + } | |
| 233 | + } | |
| 234 | + return result; | |
| 235 | +} | |
| 230 | 236 | |
| 237 | +QVector<EntityItemID> EntityScriptingInterface::findEntitiesInBox(const glm::vec3& corner, const glm::vec3& dimensions) const { | |
| 238 | + QVector<EntityItemID> result; | |
| 239 | + if (_entityTree) { | |
| 240 | + _entityTree->lockForRead(); | |
| 241 | + AABox box(corner, dimensions); | |
| 242 | + QVector<EntityItem*> entities; | |
| 243 | + _entityTree->findEntities(box, entities); | |
| 244 | + _entityTree->unlock(); | |
| 245 | + | |
| 231 | 246 | foreach (const EntityItem* entity, entities) { |
| 232 | − EntityItemID thisEntityItemID(entity->getID(), UNKNOWN_ENTITY_TOKEN, true); | |
| 233 | − result << thisEntityItemID; | |
| 247 | + result << entity->getEntityItemID(); | |
| 234 | 248 | } |
| 235 | 249 | } |
| 236 | 250 | return result; |