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
610610 }
611611
612612 RayToEntityIntersectionResult 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) {
614614
615615 QVector<EntityItemID> entitiesToInclude = qVectorEntityItemIDFromScriptValue(entityIdsToInclude);
616616 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);
618618 }
619619
620620 // 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
629629 }
630630
631631 RayToEntityIntersectionResult EntityScriptingInterface::findRayIntersectionWorker(const PickRay& ray,
632− Octree::lockType lockType,
633− bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude, const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly) {
632+ Octree::lockType lockType, bool precisionPicking, const QVector<EntityItemID>& entityIdsToInclude,
633+ const QVector<EntityItemID>& entityIdsToDiscard, bool visibleOnly, bool collidableOnly) {
634634
635635
636636 RayToEntityIntersectionResult result;
637637 if (_entityTree) {
638638 OctreeElementPointer element;
639639 EntityItemPointer intersectedEntity = NULL;
640− result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction, element, result.distance, result.face,
641− result.surfaceNormal, entityIdsToInclude, entityIdsToDiscard, visibleOnly, (void**)&intersectedEntity, lockType, &result.accurate,
642− precisionPicking);
640+ result.intersects = _entityTree->findRayIntersection(ray.origin, ray.direction,
641+ entityIdsToInclude, entityIdsToDiscard, visibleOnly, collidableOnly, precisionPicking,
642+ element, result.distance, result.face, result.surfaceNormal,
643+ (void**)&intersectedEntity, lockType, &result.accurate);
643644 if (result.intersects && intersectedEntity) {
644645 result.entityID = intersectedEntity->getEntityItemID();
645646 result.properties = intersectedEntity->getProperties();