mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Recast: enforce consistency in intersection code
Some code uses different timing bounds. Enforce consistency between all code utilizing this.
This commit is contained in:
parent
eb6a3b37d2
commit
b37a77d547
@ -758,7 +758,7 @@ int CrowdToolState::hitTestAgents(const float* s, const float* p)
|
||||
dtCrowd* crowd = m_editor->getCrowd();
|
||||
|
||||
int isel = -1;
|
||||
float tsel = FLT_MAX;
|
||||
float tsel = 1;
|
||||
|
||||
for (int i = 0; i < crowd->getAgentCount(); ++i)
|
||||
{
|
||||
|
@ -562,7 +562,7 @@ void drawDetailOverlay(const dtTileCache* tc, const int tx, const int ty, double
|
||||
|
||||
dtObstacleRef hitTestObstacle(const dtTileCache* tc, const float* sp, const float* sq)
|
||||
{
|
||||
float tmin = FLT_MAX;
|
||||
float tmin = 1;
|
||||
const dtTileCacheObstacle* obmin = 0;
|
||||
for (int i = 0; i < tc->getObstacleCount(); ++i)
|
||||
{
|
||||
|
@ -186,8 +186,8 @@ bool rdIntersectSegmentAABB(const float* sp, const float* sq,
|
||||
{
|
||||
float d[3];
|
||||
rdVsub(d, sq, sp);
|
||||
tmin = 0; // set to -FLT_MAX to get first hit on line
|
||||
tmax = FLT_MAX; // set to max distance ray can travel (for segment)
|
||||
tmin = 0; // set to 0 to get first hit on line
|
||||
tmax = 1; // set to max distance ray can travel (for segment)
|
||||
|
||||
// For all three slabs
|
||||
for (int i = 0; i < 3; i++)
|
||||
@ -221,6 +221,9 @@ bool rdIntersectSegmentCylinder(const float* sp, const float* sq, const float* p
|
||||
const float radius, const float height,
|
||||
float& tmin, float& tmax)
|
||||
{
|
||||
tmin = 0;
|
||||
tmax = 1;
|
||||
|
||||
const float cx = position[0];
|
||||
const float cy = position[1];
|
||||
const float cz = position[2];
|
||||
@ -249,8 +252,8 @@ bool rdIntersectSegmentCylinder(const float* sp, const float* sq, const float* p
|
||||
|
||||
if (t0 > t1) rdSwap(t0, t1);
|
||||
|
||||
tmin = rdMax(0.0f, t0);
|
||||
tmax = rdMin(1.0f, t1);
|
||||
tmin = rdMax(tmin, t0);
|
||||
tmax = rdMin(tmax, t1);
|
||||
|
||||
if (tmin > tmax)
|
||||
return false; // No intersection in the [tmin, tmax] range
|
||||
|
Loading…
x
Reference in New Issue
Block a user