From ce61bff759b6876882b1b023e284df3bfd79b7c6 Mon Sep 17 00:00:00 2001 From: Jummit Date: Thu, 31 Oct 2019 16:29:41 +0100 Subject: [PATCH] link SoftBody tutorial in docs and add ray_pickable property --- doc/classes/SoftBody.xml | 24 ++++++++---------------- scene/3d/soft_body.cpp | 7 +++++-- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/doc/classes/SoftBody.xml b/doc/classes/SoftBody.xml index 5cde31fa590..e4a5087db54 100644 --- a/doc/classes/SoftBody.xml +++ b/doc/classes/SoftBody.xml @@ -7,6 +7,7 @@ A deformable physics body. Used to create elastic or deformable objects such as cloth, rubber, or other flexible materials. + https://docs.godotengine.org/en/latest/tutorials/physics/soft_body.html @@ -43,12 +44,6 @@ Returns an individual bit on the collision mask. - - - - - - @@ -80,25 +75,20 @@ Sets individual bits on the collision mask. Use this if you only need to change one layer's value. - - - - - - - - + + If true, the [SoftBody] will respond to [RayCast]s. + - The physics layers this area is in. + The physics layers this SoftBody is in. Collidable objects can exist in any of 32 different layers. These layers work like a tagging system, and are not visual. A collidable can use these layers to select with which objects it can collide, using the collision_mask property. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layer scanned by object A. - The physics layers this area scans for collisions. + The physics layers this SoftBody scans for collisions. @@ -107,6 +97,7 @@ + [NodePath] to a [CollisionObject] this SoftBody should avoid clipping. @@ -116,6 +107,7 @@ Increasing this value will improve the resulting simulation, but can affect performance. Use with care. + The SoftBody's mass. diff --git a/scene/3d/soft_body.cpp b/scene/3d/soft_body.cpp index 6c3949a0a8a..f4710614951 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 { @@ -698,7 +700,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);