From 02bc779866530479124b8fc00a4a48aa1cc3b7e2 Mon Sep 17 00:00:00 2001 From: Dennis Date: Wed, 9 Aug 2017 21:32:31 +0200 Subject: [PATCH] Update com_jme3_bullet_objects_PhysicsRigidBody.cpp (#702) * Update com_jme3_bullet_objects_PhysicsRigidBody.cpp From docu here: http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Activation_States .. ACTIVE_TAG Means active so that the object having the state could be moved in a step simulation. This is the "normal" state for an object to be in. Use btCollisionObject::activate() to activate an object, not btCollisionObject::setActivationState(ACTIVATE_TAG), or it may get disabled again right away, as the deactivation timer has not been reset. .. * Update com_jme3_bullet_objects_PhysicsRigidBody.cpp Settin RigidBody kinematic and then back dynamic will leave activation state to disabled causing the object never fall to sleep. --- .../native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp index e4d0c74bf..9241bcf5b 100644 --- a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp +++ b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_objects_PhysicsRigidBody.cpp @@ -217,7 +217,8 @@ extern "C" { body->setActivationState(DISABLE_DEACTIVATION); } else { body->setCollisionFlags(body->getCollisionFlags() & ~btCollisionObject::CF_KINEMATIC_OBJECT); - body->setActivationState(ACTIVE_TAG); + body->activate(true); + body->forceActivationState(ACTIVE_TAG); } }