summaryrefslogtreecommitdiff
path: root/modules/bullet/soft_body_bullet.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-07-07 12:15:09 +0200
committerGitHub <noreply@github.com>2020-07-07 12:15:09 +0200
commitbd3a468fc243d47f2e7e56386b82bed38536b60e (patch)
tree97fe8f231194c9f480792fe6f14c990dac9638cb /modules/bullet/soft_body_bullet.cpp
parent480cb25961a20b488a035ad936fde9b333b66090 (diff)
parent7709a8349354b469361ec7e1429af0dc8af80b2a (diff)
Merge pull request #39726 from AndreaCatania/add_body_impr_physics
Optimized physics object spawn time
Diffstat (limited to 'modules/bullet/soft_body_bullet.cpp')
-rw-r--r--modules/bullet/soft_body_bullet.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/bullet/soft_body_bullet.cpp b/modules/bullet/soft_body_bullet.cpp
index 6794d6c313..3fccd3d8a2 100644
--- a/modules/bullet/soft_body_bullet.cpp
+++ b/modules/bullet/soft_body_bullet.cpp
@@ -41,7 +41,7 @@ SoftBodyBullet::SoftBodyBullet() :
SoftBodyBullet::~SoftBodyBullet() {
}
-void SoftBodyBullet::reload_body() {
+void SoftBodyBullet::do_reload_body() {
if (space) {
space->remove_soft_body(this);
space->add_soft_body(this);
@@ -51,13 +51,15 @@ void SoftBodyBullet::reload_body() {
void SoftBodyBullet::set_space(SpaceBullet *p_space) {
if (space) {
isScratched = false;
+ space->unregister_collision_object(this);
space->remove_soft_body(this);
}
space = p_space;
if (space) {
- space->add_soft_body(this);
+ space->register_collision_object(this);
+ reload_body();
}
}