diff options
author | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-20 10:53:25 -0700 |
---|---|---|
committer | PouleyKetchoupp <pouleyketchoup@gmail.com> | 2021-10-20 10:57:08 -0700 |
commit | 1f816979f6f30e09d8bf68d163775e1c2b105551 (patch) | |
tree | 8981708967c43e6372e05f2f176aebf91c92fbbf /scene/3d/soft_dynamic_body_3d.h | |
parent | a4fbb67902f493bff503dafd0ccc6277af85f3a1 (diff) |
Fix SoftDynamicBody3D memory corruption when switching mesh at runtime
When switching the mesh at runtime, the physics server wasn't properly
updated with the new mesh. Now we keep track of the soft body mesh to
make sure everything is properly initialized on pre-draw.
Also cleaned a few things around private methods.
Diffstat (limited to 'scene/3d/soft_dynamic_body_3d.h')
-rw-r--r-- | scene/3d/soft_dynamic_body_3d.h | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/scene/3d/soft_dynamic_body_3d.h b/scene/3d/soft_dynamic_body_3d.h index 5e7fbfe29e..57e116aa05 100644 --- a/scene/3d/soft_dynamic_body_3d.h +++ b/scene/3d/soft_dynamic_body_3d.h @@ -90,7 +90,7 @@ private: DisableMode disable_mode = DISABLE_MODE_REMOVE; - bool mesh_owner = false; + RID owned_mesh; uint32_t collision_mask = 1; uint32_t collision_layer = 1; NodePath parent_collision_ignore; @@ -106,6 +106,12 @@ private: void _update_pickable(); + void _update_physics_server(); + void _draw_soft_mesh(); + + void _prepare_physics_server(); + void _become_mesh_owner(); + protected: bool _set(const StringName &p_name, const Variant &p_value); bool _get(const StringName &p_name, Variant &r_ret) const; @@ -120,14 +126,7 @@ protected: TypedArray<String> get_configuration_warnings() const override; -protected: - void _update_physics_server(); - void _draw_soft_mesh(); - public: - void prepare_physics_server(); - void become_mesh_owner(); - RID get_physics_rid() const { return physics_rid; } void set_collision_mask(uint32_t p_mask); |