summaryrefslogtreecommitdiffstats
path: root/modules/bullet/soft_body_bullet.cpp
diff options
context:
space:
mode:
authorAndrea Catania <info@andreacatania.com>2020-06-21 12:48:40 +0200
committerAndrea Catania <info@andreacatania.com>2020-06-24 08:54:11 +0200
commit7709a8349354b469361ec7e1429af0dc8af80b2a (patch)
treee513c29e2a8b00ef98425c8e5b946b0b1fa85890 /modules/bullet/soft_body_bullet.cpp
parentd360e6fb46fe425b7cc42a04adc62d1b564a0806 (diff)
downloadredot-engine-7709a8349354b469361ec7e1429af0dc8af80b2a.tar.gz
Optimized physics object spawn time and optimized shape usage when the shape is not scaled
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();
}
}