diff options
author | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-08-30 14:20:25 -0300 |
---|---|---|
committer | Michael Alexsander Silva Dias <michaelalexsander@protonmail.com> | 2019-08-30 14:22:46 -0300 |
commit | c902066bb5276d664dbd3c61cb5a3adf28ee6491 (patch) | |
tree | 82c9c1b1f99eab56ea6a301c6c8b04a892c88b3a /scene | |
parent | ba854bbc7bb0eae230299de4da8dfcb7caf74b69 (diff) |
Remove some unneeded checks in CollisionObject(2D)
Diffstat (limited to 'scene')
-rw-r--r-- | scene/2d/collision_object_2d.cpp | 7 | ||||
-rw-r--r-- | scene/3d/collision_object.cpp | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/scene/2d/collision_object_2d.cpp b/scene/2d/collision_object_2d.cpp index 202c7c9cf2..228b67990c 100644 --- a/scene/2d/collision_object_2d.cpp +++ b/scene/2d/collision_object_2d.cpp @@ -376,11 +376,12 @@ void CollisionObject2D::set_only_update_transform_changes(bool p_enable) { void CollisionObject2D::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = this->pickable && is_inside_tree() && is_visible_in_tree(); + + bool is_pickable = pickable && is_visible_in_tree(); if (area) - Physics2DServer::get_singleton()->area_set_pickable(rid, pickable); + Physics2DServer::get_singleton()->area_set_pickable(rid, is_pickable); else - Physics2DServer::get_singleton()->body_set_pickable(rid, pickable); + Physics2DServer::get_singleton()->body_set_pickable(rid, is_pickable); } String CollisionObject2D::get_configuration_warning() const { diff --git a/scene/3d/collision_object.cpp b/scene/3d/collision_object.cpp index 63301fc226..735b393171 100644 --- a/scene/3d/collision_object.cpp +++ b/scene/3d/collision_object.cpp @@ -105,7 +105,8 @@ void CollisionObject::_mouse_exit() { void CollisionObject::_update_pickable() { if (!is_inside_tree()) return; - bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree(); + + bool pickable = ray_pickable && is_visible_in_tree(); if (area) PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable); else |