Merge pull request #259 from SHADE-DP/SP3-2-Physics
Fixed fatal bug where rigidbody masses was incorrectly computed when editor is enabled
This commit is contained in:
commit
87936f1e31
|
@ -250,9 +250,7 @@ namespace SHADE
|
||||||
}
|
}
|
||||||
|
|
||||||
// A static rigid body is implicitly created on creation of a physics object.
|
// 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.
|
// Nothing is needed here.
|
||||||
|
|
||||||
physicsObject->SyncRigidBody(*componentGroup.rigidBodyComponent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHPhysicsObjectManager::addCollider(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
void SHPhysicsObjectManager::addCollider(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
||||||
|
@ -269,7 +267,7 @@ namespace SHADE
|
||||||
//for (int i = 0; i < NUM_SHAPES; ++i)
|
//for (int i = 0; i < NUM_SHAPES; ++i)
|
||||||
// physicsObject->AddCollisionShape(i);
|
// physicsObject->AddCollisionShape(i);
|
||||||
|
|
||||||
//physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
physicsObject->SyncColliders(*componentGroup.colliderComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
void SHPhysicsObjectManager::removeRigidBody(const QueueCommand&, SHPhysicsObject* physicsObject, const PhysicsComponentGroup& componentGroup)
|
||||||
|
|
|
@ -411,7 +411,14 @@ namespace SHADE
|
||||||
objectManager.AddRigidBody(EID);
|
objectManager.AddRigidBody(EID);
|
||||||
|
|
||||||
if (SHComponentManager::HasComponent<SHColliderComponent>(EID))
|
if (SHComponentManager::HasComponent<SHColliderComponent>(EID))
|
||||||
|
{
|
||||||
objectManager.AddCollider(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
|
// Sync transforms & physics components transforms
|
||||||
if (transformComponent && transformComponent->HasChanged())
|
if (transformComponent && transformComponent->HasChanged())
|
||||||
{
|
{
|
||||||
|
physicsObject.GetRigidBody()->setIsSleeping(false);
|
||||||
|
|
||||||
preUpdateSyncTransform
|
preUpdateSyncTransform
|
||||||
(
|
(
|
||||||
physicsObject
|
physicsObject
|
||||||
|
|
Loading…
Reference in New Issue