Implemented a custom physics engine #316
|
@ -17,6 +17,7 @@
|
|||
#include "Events/SHEvent.h"
|
||||
#include "Math/SHMathHelpers.h"
|
||||
#include "Physics/SHPhysicsEvents.h"
|
||||
#include "Physics/Dynamics/SHRigidBody.h"
|
||||
|
||||
|
||||
namespace SHADE
|
||||
|
@ -277,6 +278,9 @@ namespace SHADE
|
|||
|
||||
SHEventManager::BroadcastEvent<SHPhysicsColliderAddedEvent>(EVENT_DATA, SH_PHYSICS_COLLIDER_ADDED_EVENT);
|
||||
|
||||
if (rigidBody)
|
||||
rigidBody->ComputeMassData();
|
||||
|
||||
return static_cast<int>(shapes.size());
|
||||
}
|
||||
|
||||
|
@ -316,6 +320,9 @@ namespace SHADE
|
|||
// Broadcast Event for removing a shape
|
||||
SHEventManager::BroadcastEvent<SHPhysicsColliderRemovedEvent>(EVENT_DATA, SH_PHYSICS_COLLIDER_REMOVED_EVENT);
|
||||
|
||||
if (rigidBody)
|
||||
rigidBody->ComputeMassData();
|
||||
|
||||
SHLOG_INFO_D("Removing Collision Shape {} from Entity {}", index, entityID)
|
||||
}
|
||||
|
||||
|
|
|
@ -598,7 +598,7 @@ namespace SHADE
|
|||
const SHMatrix ROTATION = SHMatrix::Rotate(motionState.orientation);
|
||||
|
||||
// Compute world inertia
|
||||
worldInvInertia = ROTATION * localInvInertia * SHMatrix::Transpose(ROTATION);
|
||||
worldInvInertia = SHMatrix::Transpose(ROTATION) * localInvInertia * ROTATION;
|
||||
|
||||
// Compute world centroid
|
||||
worldCentroid = (ROTATION * localCentroid) + motionState.position;
|
||||
|
|
Loading…
Reference in New Issue