Merge pull request #31805 from YeldhamDev/collision_object_unneeded_checks
Remove some unneeded checks in CollisionObject(2D)
This commit is contained in:
commit
4f6eb3610f
2 changed files with 6 additions and 4 deletions
|
@ -376,11 +376,12 @@ void CollisionObject2D::set_only_update_transform_changes(bool p_enable) {
|
||||||
void CollisionObject2D::_update_pickable() {
|
void CollisionObject2D::_update_pickable() {
|
||||||
if (!is_inside_tree())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
bool pickable = this->pickable && is_inside_tree() && is_visible_in_tree();
|
|
||||||
|
bool is_pickable = pickable && is_visible_in_tree();
|
||||||
if (area)
|
if (area)
|
||||||
Physics2DServer::get_singleton()->area_set_pickable(rid, pickable);
|
Physics2DServer::get_singleton()->area_set_pickable(rid, is_pickable);
|
||||||
else
|
else
|
||||||
Physics2DServer::get_singleton()->body_set_pickable(rid, pickable);
|
Physics2DServer::get_singleton()->body_set_pickable(rid, is_pickable);
|
||||||
}
|
}
|
||||||
|
|
||||||
String CollisionObject2D::get_configuration_warning() const {
|
String CollisionObject2D::get_configuration_warning() const {
|
||||||
|
|
|
@ -105,7 +105,8 @@ void CollisionObject::_mouse_exit() {
|
||||||
void CollisionObject::_update_pickable() {
|
void CollisionObject::_update_pickable() {
|
||||||
if (!is_inside_tree())
|
if (!is_inside_tree())
|
||||||
return;
|
return;
|
||||||
bool pickable = ray_pickable && is_inside_tree() && is_visible_in_tree();
|
|
||||||
|
bool pickable = ray_pickable && is_visible_in_tree();
|
||||||
if (area)
|
if (area)
|
||||||
PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable);
|
PhysicsServer::get_singleton()->area_set_ray_pickable(rid, pickable);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue