diff options
Diffstat (limited to 'modules/bullet/soft_body_bullet.cpp')
-rw-r--r-- | modules/bullet/soft_body_bullet.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp index 3047a3eed1..6794d6c313 100644 --- a/modules/bullet/soft_body_bullet.cpp +++ b/modules/bullet/soft_body_bullet.cpp @@ -66,8 +66,9 @@ void SoftBodyBullet::on_enter_area(AreaBullet *p_area) {} void SoftBodyBullet::on_exit_area(AreaBullet *p_area) {} void SoftBodyBullet::update_rendering_server(SoftBodyRenderingServerHandler *p_rendering_server_handler) { - if (!bt_soft_body) + if (!bt_soft_body) { return; + } /// Update visual server vertices const btSoftBody::tNodeArray &nodes(bt_soft_body->m_nodes); @@ -105,10 +106,11 @@ void SoftBodyBullet::update_rendering_server(SoftBodyRenderingServerHandler *p_r } void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) { - if (p_mesh.is_null()) + if (p_mesh.is_null()) { soft_mesh.unref(); - else + } else { soft_mesh = p_mesh; + } if (soft_mesh.is_null()) { destroy_soft_body(); @@ -121,8 +123,9 @@ void SoftBodyBullet::set_soft_mesh(const Ref<Mesh> &p_mesh) { } void SoftBodyBullet::destroy_soft_body() { - if (!bt_soft_body) + if (!bt_soft_body) { return; + } if (space) { /// Remove from world before deletion @@ -139,8 +142,9 @@ void SoftBodyBullet::set_soft_transform(const Transform &p_transform) { } void SoftBodyBullet::move_all_nodes(const Transform &p_transform) { - if (!bt_soft_body) + if (!bt_soft_body) { return; + } btTransform bt_transf; G_TO_B(p_transform, bt_transf); bt_soft_body->transform(bt_transf); @@ -166,8 +170,9 @@ void SoftBodyBullet::get_node_position(int p_node_index, Vector3 &r_position) co } void SoftBodyBullet::get_node_offset(int p_node_index, Vector3 &r_offset) const { - if (soft_mesh.is_null()) + if (soft_mesh.is_null()) { return; + } Array arrays = soft_mesh->surface_get_arrays(0); Vector<Vector3> vertices(arrays[RS::ARRAY_VERTEX]); @@ -212,8 +217,9 @@ void SoftBodyBullet::reset_all_node_mass() { } void SoftBodyBullet::reset_all_node_positions() { - if (soft_mesh.is_null()) + if (soft_mesh.is_null()) { return; + } Array arrays = soft_mesh->surface_get_arrays(0); Vector<Vector3> vs_vertices(arrays[RS::ARRAY_VERTEX]); @@ -382,8 +388,9 @@ void SoftBodyBullet::set_trimesh_body_shape(Vector<int> p_indices, Vector<Vector } void SoftBodyBullet::setup_soft_body() { - if (!bt_soft_body) + if (!bt_soft_body) { return; + } // Soft body setup setupBulletCollisionObject(bt_soft_body); |