Fixed a bug where changing the transform of a Collider attached to a sleeping RigidBody caused the body to remain asleep

This commit is contained in:
Minigee 2021-06-26 02:30:14 -05:00
parent de86e9cbbd
commit 288627bd41
2 changed files with 2 additions and 1 deletions

View File

@ -222,6 +222,7 @@ class RigidBody : public CollisionBody {
friend class SolveHingeJointSystem;
friend class SolveSliderJointSystem;
friend class Joint;
friend class Collider;
};
/// Compute the inverse of the inertia tensor in world coordinates.

View File

@ -114,7 +114,7 @@ void Collider::setLocalToBodyTransform(const Transform& transform) {
RigidBody* rigidBody = static_cast<RigidBody*>(mBody);
if (rigidBody != nullptr) {
mBody->mWorld.mRigidBodyComponents.setIsSleeping(mBody->getEntity(), false);
rigidBody->setIsSleeping(false);
}
mBody->mWorld.mCollisionDetection.updateCollider(mEntity, 0);