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;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue