History

Add collidableOnly arg to findRayIntersection

Ryan Huffman committed 10 years ago

Commit ee504691 parent 75265cf8 files · +69 −52Browse files

Showing the changes to libraries/entities/src/EntityScriptingInterface.cpp (1 of 8 files). Show all

Unified · Split

libraries/entities/src/EntityScriptingInterface.cpp+8−7
@@ -610,11 +610,11 @@ QVector<QUuid> EntityScriptingInterface::findEntitiesInFrustum(QVariantMap frust · 609 unmodified lines
610}610}
611 611
612RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking, 612RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersection(const PickRay& ray, bool precisionPicking,
613 const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard, bool visibleOnly) {613 const QScriptValue& entityIdsToInclude, const QScriptValue& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) {
614 614
615 QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);615 QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
616 QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);616 QVector<EntityItemID> entitiesToDiscard = qVectorEntityItemIDFromScriptValue(entityIdsToDiscard);
617 return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard, visibleOnly);617 return findRayIntersectionWorker(ray, Octree::Lock, precisionPicking, entitiesToInclude, entitiesToDiscard, visibleOnly, collidableOnly);
618}618}
619 619
620// FIXME - we should remove this API and encourage all users to use findRayIntersection() instead. We've changed620// FIXME - we should remove this API and encourage all users to use findRayIntersection() instead. We've changed
@@ -629,17 +629,18 @@ RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionBlock · 8 unmodified lines
629}629}
630 630
631RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorker(const PickRay& ray,631RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorker(const PickRay& ray,
632 Octree::lockType lockType,632 Octree::lockType lockType, bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude,
633 bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly) {633 const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) {
634 634
635 635
636 RayToEntityIntersectionResult result;636 RayToEntityIntersectionResult result;
637 if (_entityTree) {637 if (_entityTree) {
638 OctreeElementPointer element;638 OctreeElementPointer element;
639 EntityItemPointer intersectedEntity = NULL;639 EntityItemPointer intersectedEntity = NULL;
640 result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face,640 result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction,
641 result.surfaceNormal, entityIdsToInclude, entityIdsToDiscard, visibleOnly, (void**)&intersectedEntity, lockType, &result.accurate,641 entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking,
642 precisionPicking);642 element, result.distance, result.face, result.surfaceNormal,
643 (void**)&intersectedEntity, lockType, &result.accurate);
643 if (result.intersects && intersectedEntity) {644 if (result.intersects && intersectedEntity) {
644 result.entityID = intersectedEntity->getEntityItemID();645 result.entityID = intersectedEntity->getEntityItemID();
645 result.properties = intersectedEntity->getProperties();646 result.properties = intersectedEntity->getProperties();