summaryrefslogtreecommitdiff
path: root/modules/bullet/rigid_body_bullet.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/bullet/rigid_body_bullet.cpp')
-rw-r--r--modules/bullet/rigid_body_bullet.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 09177205b4..22f2214898 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -797,6 +797,9 @@ void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transfor
btBody->setLinearVelocity((p_global_transform.getOrigin() - btBody->getWorldTransform().getOrigin()) / space->get_delta_time());
// The kinematic use MotionState class
godotMotionState->moveBody(p_global_transform);
+ } else {
+ // Is necesasry to avoid wrong location on the rendering side on the next frame
+ godotMotionState->setWorldTransform(p_global_transform);
}
CollisionObjectBullet::set_transform__bullet(p_global_transform);
}
@@ -822,7 +825,8 @@ void RigidBodyBullet::reload_shapes() {
// shapes incorrectly do not set the vector in calculateLocalIntertia.
// Arbitrary zero is preferable to undefined behaviour.
btVector3 inertia(0, 0, 0);
- mainShape->calculateLocalInertia(mass, inertia);
+ if (EMPTY_SHAPE_PROXYTYPE != mainShape->getShapeType()) // Necessary to avoid assertion of the empty shape
+ mainShape->calculateLocalInertia(mass, inertia);
btBody->setMassProps(mass, inertia);
}
btBody->updateInertiaTensor();