mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
Merge pull request #9620 from hyperlogic/bug-fix/find-entity-bug
Fix for findEntities not returning some entities that are within range.
This commit is contained in:
commit
caefb6c711
3 changed files with 16 additions and 1 deletions
|
@ -360,7 +360,7 @@ glm::vec3 AABox::getClosestPointOnFace(const glm::vec3& point, BoxFace face) con
|
||||||
|
|
||||||
case MIN_Z_FACE:
|
case MIN_Z_FACE:
|
||||||
return glm::clamp(point, glm::vec3(_corner.x, _corner.y, _corner.z),
|
return glm::clamp(point, glm::vec3(_corner.x, _corner.y, _corner.z),
|
||||||
glm::vec3(_corner.x + _scale.z, _corner.y + _scale.y, _corner.z));
|
glm::vec3(_corner.x + _scale.x, _corner.y + _scale.y, _corner.z));
|
||||||
|
|
||||||
default: //quiet windows warnings
|
default: //quiet windows warnings
|
||||||
case MAX_Z_FACE:
|
case MAX_Z_FACE:
|
||||||
|
|
|
@ -169,3 +169,17 @@ void AABoxTests::testScale() {
|
||||||
box3 += glm::vec3(-1.0f, -1.0f, -1.0f);
|
box3 += glm::vec3(-1.0f, -1.0f, -1.0f);
|
||||||
QCOMPARE(box3.contains(glm::vec3(0.5f, 0.5f, 0.5f)), true);
|
QCOMPARE(box3.contains(glm::vec3(0.5f, 0.5f, 0.5f)), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AABoxTests::testFindSpherePenetration() {
|
||||||
|
vec3 searchPosition(-0.0141186f, 0.0640736f, -0.116081f);
|
||||||
|
float searchRadius = 0.5f;
|
||||||
|
|
||||||
|
vec3 boxMin(-0.800014f, -0.450025f, -0.00503815f);
|
||||||
|
vec3 boxDim(1.60003f, 0.900049f, 0.0100763f);
|
||||||
|
AABox testBox(boxMin, boxDim);
|
||||||
|
|
||||||
|
vec3 penetration;
|
||||||
|
bool hit = testBox.findSpherePenetration(searchPosition, searchRadius, penetration);
|
||||||
|
QCOMPARE(hit, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ private slots:
|
||||||
void testContainsPoint();
|
void testContainsPoint();
|
||||||
void testTouchesSphere();
|
void testTouchesSphere();
|
||||||
void testScale();
|
void testScale();
|
||||||
|
void testFindSpherePenetration();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_AABoxTests_h
|
#endif // hifi_AABoxTests_h
|
||||||
|
|
Loading…
Reference in a new issue