diff options
author | Andrea Catania <info@andreacatania.com> | 2020-06-21 12:48:40 +0200 |
---|---|---|
committer | Andrea Catania <info@andreacatania.com> | 2020-06-24 08:54:11 +0200 |
commit | 7709a8349354b469361ec7e1429af0dc8af80b2a (patch) | |
tree | e513c29e2a8b00ef98425c8e5b946b0b1fa85890 /modules/bullet/area_bullet.cpp | |
parent | d360e6fb46fe425b7cc42a04adc62d1b564a0806 (diff) | |
download | redot-engine-7709a8349354b469361ec7e1429af0dc8af80b2a.tar.gz |
Optimized physics object spawn time and optimized shape usage when the shape is not scaled
Diffstat (limited to 'modules/bullet/area_bullet.cpp')
-rw-r--r-- | modules/bullet/area_bullet.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/bullet/area_bullet.cpp b/modules/bullet/area_bullet.cpp index 79d8e252f0..4964a6c8c9 100644 --- a/modules/bullet/area_bullet.cpp +++ b/modules/bullet/area_bullet.cpp @@ -164,7 +164,7 @@ void AreaBullet::main_shape_changed() { btGhost->setCollisionShape(get_main_shape()); } -void AreaBullet::reload_body() { +void AreaBullet::do_reload_body() { if (space) { space->remove_area(this); space->add_area(this); @@ -177,13 +177,15 @@ void AreaBullet::set_space(SpaceBullet *p_space) { isScratched = false; // Remove this object form the physics world + space->unregister_collision_object(this); space->remove_area(this); } space = p_space; if (space) { - space->add_area(this); + space->register_collision_object(this); + reload_body(); } } |