summaryrefslogtreecommitdiffstats
path: root/src/render/jobs/pickboundingvolumeutils.cpp
diff options
context:
space:
mode:
authorKevin Ottens <kevin.ottens@kdab.com>2016-11-04 11:00:11 +0100
committerKevin Ottens <kevin.ottens@kdab.com>2016-11-04 12:06:55 +0000
commit1e0d651608283624b3d5d64e20c410a2449e85b0 (patch)
tree5cb20a576ee457d1f36687712a0d24afbc1eb299 /src/render/jobs/pickboundingvolumeutils.cpp
parent8e242ca96953df1e1300fb5fb10783c8568e9af6 (diff)
Fix picking on child entities
Picking was broken for child entities of an entity having an object picker. This commit addresses it. It was due to in practice always testing the entities with object picker and not their children since when verifying the presence of an object picker the information of the original entity tested was lost. Change-Id: Icce29b2bf4424ae8c51a8b4fc26cbe9b9b0041e5 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'src/render/jobs/pickboundingvolumeutils.cpp')
-rw-r--r--src/render/jobs/pickboundingvolumeutils.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/render/jobs/pickboundingvolumeutils.cpp b/src/render/jobs/pickboundingvolumeutils.cpp
index c9f14490a..fd4eded27 100644
--- a/src/render/jobs/pickboundingvolumeutils.cpp
+++ b/src/render/jobs/pickboundingvolumeutils.cpp
@@ -174,10 +174,11 @@ AbstractCollisionGathererFunctor::result_type AbstractCollisionGathererFunctor::
// If the Entity which actually received the hit doesn't have
// an object picker component, we need to check the parent if it has one ...
- while (objectPickerHandle.isNull() && entity != nullptr) {
- entity = entity->parent();
- if (entity != nullptr)
- objectPickerHandle = entity->componentHandle<ObjectPicker, 16>();
+ auto parentEntity = entity;
+ while (objectPickerHandle.isNull() && parentEntity != nullptr) {
+ parentEntity = parentEntity->parent();
+ if (parentEntity != nullptr)
+ objectPickerHandle = parentEntity->componentHandle<ObjectPicker, 16>();
}
ObjectPicker *objectPicker = m_manager->objectPickerManager()->data(objectPickerHandle);