summaryrefslogtreecommitdiff
path: root/modules/bullet
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-01-21 08:13:53 +0100
committerGitHub <noreply@github.com>2020-01-21 08:13:53 +0100
commita9487821102b006d9afb05dee3be78a7e4ed8023 (patch)
tree682cee8a349c19d627460cb77267b3db3f2c499a /modules/bullet
parent77f04ec52a0e41d3af5f084f8e989f728239b16f (diff)
parent41b21dee019a643e35ee6e5462afe6bb4ffc2c5f (diff)
Merge pull request #35385 from akien-mga/bullet-prevent-div-by-zero
Bullet: Prevent potential division by zero
Diffstat (limited to 'modules/bullet')
-rw-r--r--modules/bullet/rigid_body_bullet.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/modules/bullet/rigid_body_bullet.cpp b/modules/bullet/rigid_body_bullet.cpp
index 1dd75eb8a9..16a8cf8ede 100644
--- a/modules/bullet/rigid_body_bullet.cpp
+++ b/modules/bullet/rigid_body_bullet.cpp
@@ -795,12 +795,12 @@ Vector3 RigidBodyBullet::get_angular_velocity() const {
void RigidBodyBullet::set_transform__bullet(const btTransform &p_global_transform) {
if (mode == PhysicsServer::BODY_MODE_KINEMATIC) {
- if (space)
+ if (space && space->get_delta_time() != 0)
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
+ // Is necessary to avoid wrong location on the rendering side on the next frame
godotMotionState->setWorldTransform(p_global_transform);
}
CollisionObjectBullet::set_transform__bullet(p_global_transform);