Fixed fatal bug where rigidbody masses was incorrectly computed when editor is enabled #259
|
@ -250,9 +250,7 @@ namespace SHADE
|
|||
}
|
||||
|
||||
// A static rigid body is implicitly created on creation of a physics object.
|
||||
// We only need to sync rigid bodies here in the event it is non-static.
|
||||
|
||||
physicsObject->SyncRigidBody(*componentGroup.rigidBodyComponent);
|
||||
// Nothing is needed here.
|
||||
}
|
||||
|
||||
void SHPhysicsObjectManager::addCollider(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
||||
|
@ -269,7 +267,7 @@ namespace SHADE
|
|||
//for (int i = 0; i < NUM_SHAPES; ++i)
|
||||
// physicsObject->AddCollisionShape(i);
|
||||
|
||||
//physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
||||
physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
||||
}
|
||||
|
||||
void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
||||
|
|
|
@ -411,7 +411,14 @@ namespace SHADE
|
|||
objectManager.AddRigidBody(EID);
|
||||
|
||||
if (SHComponentManager::HasComponent<SHColliderComponent>(EID))
|
||||
{
|
||||
objectManager.AddCollider(EID);
|
||||
|
||||
auto* COLLIDER = SHComponentManager::GetComponent<SHColliderComponent>(EID);
|
||||
for (size_t i = 0; i < COLLIDER->GetCollisionShapes().size(); ++i)
|
||||
objectManager.AddCollisionShape(EID, i);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
|
|
|
@ -255,6 +255,8 @@ namespace SHADE
|
|||
// Sync transforms & physics components transforms
|
||||
if (transformComponent && transformComponent->HasChanged())
|
||||
{
|
||||
physicsObject.GetRigidBody()->setIsSleeping(false);
|
||||
|
||||
preUpdateSyncTransform
|
||||
(
|
||||
physicsObject
|
||||
|
|
Loading…
Reference in New Issue