diff options
Diffstat (limited to 'scene/3d/soft_body.cpp')
-rw-r--r-- | scene/3d/soft_body.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 6c3949a0a8..6883da7f6d 100644 --- a/scene/3d/soft_body.cpp +++ b/scene/3d/soft_body.cpp @@ -115,7 +115,7 @@ SoftBody::PinnedPoint SoftBody::PinnedPoint::operator=(const PinnedPoint &obj) { void SoftBody::_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(); PhysicsServer::get_singleton()->soft_body_set_ray_pickable(physics_rid, pickable); } @@ -395,6 +395,8 @@ void SoftBody::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::REAL, "damping_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_damping_coefficient", "get_damping_coefficient"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "drag_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_drag_coefficient", "get_drag_coefficient"); ADD_PROPERTY(PropertyInfo(Variant::REAL, "pose_matching_coefficient", PROPERTY_HINT_RANGE, "0,1,0.01"), "set_pose_matching_coefficient", "get_pose_matching_coefficient"); + + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "ray_pickable"), "set_ray_pickable", "is_ray_pickable"); } String SoftBody::get_configuration_warning() const { @@ -460,7 +462,9 @@ void SoftBody::update_physics_server() { } else { PhysicsServer::get_singleton()->soft_body_set_mesh(physics_rid, NULL); - VS::get_singleton()->disconnect("frame_pre_draw", this, "_draw_soft_mesh"); + if (VS::get_singleton()->is_connected("frame_pre_draw", this, "_draw_soft_mesh")) { + VS::get_singleton()->disconnect("frame_pre_draw", this, "_draw_soft_mesh"); + } } } @@ -698,7 +702,8 @@ SoftBody::SoftBody() : collision_mask(1), collision_layer(1), simulation_started(false), - pinned_points_cache_dirty(true) { + pinned_points_cache_dirty(true), + ray_pickable(true) { PhysicsServer::get_singleton()->body_attach_object_instance_id(physics_rid, get_instance_id()); //set_notify_transform(true); |