Fixed bug where duplicate triggers were caught due to swapped entity IDs
This commit is contained in:
parent
10ba68b284
commit
4e02f64133
|
@ -231,12 +231,12 @@ namespace SHADE
|
||||||
tf.worldRotation = tf.localRotation + (parent ? parent->GetLocalRotation() : SHVec3::Zero);
|
tf.worldRotation = tf.localRotation + (parent ? parent->GetLocalRotation() : SHVec3::Zero);
|
||||||
|
|
||||||
// Set the orientation
|
// Set the orientation
|
||||||
// Wrap rotations between -360 and 360 and convert to radians
|
// Wrap rotations between -720 and 720 and convert to radians
|
||||||
SHVec3 worldRotRad, localRotRad;
|
SHVec3 worldRotRad, localRotRad;
|
||||||
for (size_t i = 0; i < SHVec3::SIZE; ++i)
|
for (size_t i = 0; i < SHVec3::SIZE; ++i)
|
||||||
{
|
{
|
||||||
worldRotRad[i] = SHMath::Wrap(tf.worldRotation[i], -SHMath::TWO_PI, SHMath::TWO_PI);
|
worldRotRad[i] = SHMath::Wrap(tf.worldRotation[i], -2.0f * SHMath::TWO_PI, 2.0f * SHMath::TWO_PI);
|
||||||
localRotRad[i] = SHMath::Wrap(tf.localRotation[i], -SHMath::TWO_PI, SHMath::TWO_PI);
|
localRotRad[i] = SHMath::Wrap(tf.localRotation[i], -2.0f * SHMath::TWO_PI, 2.0f * SHMath::TWO_PI);
|
||||||
}
|
}
|
||||||
|
|
||||||
tf.world.orientation = SHQuaternion::FromEuler(worldRotRad);
|
tf.world.orientation = SHQuaternion::FromEuler(worldRotRad);
|
||||||
|
|
|
@ -605,7 +605,6 @@ namespace SHADE
|
||||||
|
|
||||||
if (rigidBodyComponent != nullptr)
|
if (rigidBodyComponent != nullptr)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (rigidBodyComponent->GetType() == SHRigidBodyComponent::Type::STATIC)
|
if (rigidBodyComponent->GetType() == SHRigidBodyComponent::Type::STATIC)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -658,8 +657,10 @@ namespace SHADE
|
||||||
{
|
{
|
||||||
const auto IT = std::ranges::find_if(container.begin(), container.end(), [&](const SHCollisionEvent& e)
|
const auto IT = std::ranges::find_if(container.begin(), container.end(), [&](const SHCollisionEvent& e)
|
||||||
{
|
{
|
||||||
const bool ENTITY_MATCH = e.value[0] == collisionEvent.value[0];
|
const bool ENTITY_MATCH = (e.ids[0] == collisionEvent.ids[0] && e.ids[1] == collisionEvent.ids[1])
|
||||||
const bool COLLIDERS_MATCH = e.value[1] == collisionEvent.value[1];
|
|| (e.ids[0] == collisionEvent.ids[1] && e.ids[1] == collisionEvent.ids[0]);
|
||||||
|
const bool COLLIDERS_MATCH = (e.ids[2] == collisionEvent.ids[2] && e.ids[3] == collisionEvent.ids[3])
|
||||||
|
|| (e.ids[2] == collisionEvent.ids[3] && e.ids[3] == collisionEvent.ids[2]);
|
||||||
return ENTITY_MATCH && COLLIDERS_MATCH;
|
return ENTITY_MATCH && COLLIDERS_MATCH;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -183,24 +183,24 @@ namespace SHADE
|
||||||
/* Function Members */
|
/* Function Members */
|
||||||
/*---------------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
SHPhysicsObject* EnsurePhysicsObject (EntityID entityID) noexcept;
|
SHPhysicsObject* EnsurePhysicsObject (EntityID entityID) noexcept;
|
||||||
SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept;
|
SHPhysicsObject* GetPhysicsObject (EntityID entityID) noexcept;
|
||||||
void DestroyPhysicsObject (EntityID entityID) noexcept;
|
void DestroyPhysicsObject (EntityID entityID) noexcept;
|
||||||
|
|
||||||
static void SyncActiveStates (SHPhysicsObject& physicsObject, bool componentActive) noexcept;
|
static void SyncActiveStates (SHPhysicsObject& physicsObject, bool componentActive) noexcept;
|
||||||
void SyncTransforms () noexcept;
|
void SyncTransforms () noexcept;
|
||||||
|
|
||||||
static void UpdateEventContainers (const SHCollisionEvent& collisionEvent, CollisionEvents& container) noexcept;
|
static void UpdateEventContainers (const SHCollisionEvent& collisionEvent, CollisionEvents& container) noexcept;
|
||||||
void ClearInvalidCollisions () noexcept;
|
void ClearInvalidCollisions () noexcept;
|
||||||
|
|
||||||
SHEventHandle AddPhysicsComponent (SHEventPtr addComponentEvent);
|
SHEventHandle AddPhysicsComponent (SHEventPtr addComponentEvent);
|
||||||
SHEventHandle RemovePhysicsComponent (SHEventPtr removeComponentEvent);
|
SHEventHandle RemovePhysicsComponent (SHEventPtr removeComponentEvent);
|
||||||
SHEventHandle ResetWorld (SHEventPtr editorStopEvent);
|
SHEventHandle ResetWorld (SHEventPtr editorStopEvent);
|
||||||
|
|
||||||
template <typename RP3DCollisionPair, typename = std::enable_if_t
|
template <typename RP3DCollisionPair, typename = std::enable_if_t
|
||||||
<std::is_same_v<RP3DCollisionPair, rp3d::CollisionCallback::ContactPair>
|
<std::is_same_v<RP3DCollisionPair, rp3d::CollisionCallback::ContactPair>
|
||||||
|| std::is_same_v<RP3DCollisionPair, rp3d::OverlapCallback::OverlapPair>>>
|
|| std::is_same_v<RP3DCollisionPair, rp3d::OverlapCallback::OverlapPair>>>
|
||||||
SHCollisionEvent GenerateCollisionEvent (const RP3DCollisionPair& cp) noexcept;
|
SHCollisionEvent GenerateCollisionEvent (const RP3DCollisionPair& cp) noexcept;
|
||||||
};
|
};
|
||||||
} // namespace SHADE
|
} // namespace SHADE
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue