diff options
Diffstat (limited to 'scene/3d/collision_object_3d.cpp')
-rw-r--r-- | scene/3d/collision_object_3d.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/scene/3d/collision_object_3d.cpp b/scene/3d/collision_object_3d.cpp index f1ca3770e0..356992e922 100644 --- a/scene/3d/collision_object_3d.cpp +++ b/scene/3d/collision_object_3d.cpp @@ -36,26 +36,29 @@ void CollisionObject3D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_WORLD: { - if (area) + if (area) { PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform()); - else + } else { PhysicsServer3D::get_singleton()->body_set_state(rid, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + } RID space = get_world_3d()->get_space(); if (area) { PhysicsServer3D::get_singleton()->area_set_space(rid, space); - } else + } else { PhysicsServer3D::get_singleton()->body_set_space(rid, space); + } _update_pickable(); //get space } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (area) + if (area) { PhysicsServer3D::get_singleton()->area_set_transform(rid, get_global_transform()); - else + } else { PhysicsServer3D::get_singleton()->body_set_state(rid, PhysicsServer3D::BODY_STATE_TRANSFORM, get_global_transform()); + } } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -65,8 +68,9 @@ void CollisionObject3D::_notification(int p_what) { case NOTIFICATION_EXIT_WORLD: { if (area) { PhysicsServer3D::get_singleton()->area_set_space(rid, RID()); - } else + } else { PhysicsServer3D::get_singleton()->body_set_space(rid, RID()); + } } break; } @@ -94,14 +98,16 @@ void CollisionObject3D::_mouse_exit() { } void CollisionObject3D::_update_pickable() { - if (!is_inside_tree()) + if (!is_inside_tree()) { return; + } bool pickable = ray_pickable && is_visible_in_tree(); - if (area) + if (area) { PhysicsServer3D::get_singleton()->area_set_ray_pickable(rid, pickable); - else + } else { PhysicsServer3D::get_singleton()->body_set_ray_pickable(rid, pickable); + } } void CollisionObject3D::set_ray_pickable(bool p_ray_pickable) { |