Reload kinematic shapes when changing PhysicsBody mode to Kinematic

Prevents a crash when calling test_body_motion. Call reload_kinematic_shapes
from init_kinematic_utilities as they are always called together.

(cherry picked from commits 112985c5bc
and 3540e716f9)
This commit is contained in:
BimDav 2021-09-27 09:38:44 +02:00 committed by Rémi Verschelde
parent e01d609c02
commit 9de9994444
No known key found for this signature in database
GPG Key ID: C3336907360768E1
2 changed files with 1 additions and 2 deletions

View File

@ -320,6 +320,7 @@ RigidBodyBullet::~RigidBodyBullet() {
void RigidBodyBullet::init_kinematic_utilities() {
kinematic_utilities = memnew(KinematicUtilities(this));
reload_kinematic_shapes();
}
void RigidBodyBullet::destroy_kinematic_utilities() {

View File

@ -967,7 +967,6 @@ bool SpaceBullet::test_body_motion(RigidBodyBullet *p_body, const Transform &p_f
if (!p_body->get_kinematic_utilities()) {
p_body->init_kinematic_utilities();
p_body->reload_kinematic_shapes();
}
btVector3 initial_recover_motion(0, 0, 0);
@ -1109,7 +1108,6 @@ int SpaceBullet::test_ray_separation(RigidBodyBullet *p_body, const Transform &p
if (!p_body->get_kinematic_utilities()) {
p_body->init_kinematic_utilities();
p_body->reload_kinematic_shapes();
}
btVector3 recover_motion(0, 0, 0);