Optimized physics object spawn time and optimized shape usage when the shape is not scaled

This commit is contained in:
Andrea Catania 2020-06-21 12:48:40 +02:00
parent d360e6fb46
commit 7709a83493
12 changed files with 204 additions and 71 deletions

View file

@ -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();
}
}