forked from mirror/DotRecast
bugfix - bmin, bmax ref
This commit is contained in:
parent
c81c2aded9
commit
a01b0f8aa0
|
@ -358,7 +358,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cylinder obstacle
|
// Cylinder obstacle
|
||||||
public long addObstacle(float[] pos, float radius, float height)
|
public long addObstacle(Vector3f pos, float radius, float height)
|
||||||
{
|
{
|
||||||
TileCacheObstacle ob = allocObstacle();
|
TileCacheObstacle ob = allocObstacle();
|
||||||
ob.type = TileCacheObstacle.TileCacheObstacleType.CYLINDER;
|
ob.type = TileCacheObstacle.TileCacheObstacleType.CYLINDER;
|
||||||
|
@ -457,7 +457,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
CompressedTile tile = m_tiles[decodeTileIdTile(i)];
|
CompressedTile tile = m_tiles[decodeTileIdTile(i)];
|
||||||
Vector3f tbmin = new Vector3f();
|
Vector3f tbmin = new Vector3f();
|
||||||
Vector3f tbmax = new Vector3f();
|
Vector3f tbmax = new Vector3f();
|
||||||
calcTightTileBounds(tile.header, tbmin, tbmax);
|
calcTightTileBounds(tile.header, ref tbmin, ref tbmax);
|
||||||
if (overlapBounds(bmin, bmax, tbmin, tbmax))
|
if (overlapBounds(bmin, bmax, tbmin, tbmax))
|
||||||
{
|
{
|
||||||
results.Add(i);
|
results.Add(i);
|
||||||
|
@ -501,7 +501,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
// Find touched tiles.
|
// Find touched tiles.
|
||||||
Vector3f bmin = new Vector3f();
|
Vector3f bmin = new Vector3f();
|
||||||
Vector3f bmax = new Vector3f();
|
Vector3f bmax = new Vector3f();
|
||||||
getObstacleBounds(ob, bmin, bmax);
|
getObstacleBounds(ob, ref bmin, ref bmax);
|
||||||
ob.touched = queryTiles(bmin, bmax);
|
ob.touched = queryTiles(bmin, bmax);
|
||||||
// Add tiles to update list.
|
// Add tiles to update list.
|
||||||
ob.pending.Clear();
|
ob.pending.Clear();
|
||||||
|
@ -682,7 +682,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void calcTightTileBounds(TileCacheLayerHeader header, Vector3f bmin, Vector3f bmax)
|
void calcTightTileBounds(TileCacheLayerHeader header, ref Vector3f bmin, ref Vector3f bmax)
|
||||||
{
|
{
|
||||||
float cs = m_params.cs;
|
float cs = m_params.cs;
|
||||||
bmin[0] = header.bmin[0] + header.minx * cs;
|
bmin[0] = header.bmin[0] + header.minx * cs;
|
||||||
|
@ -693,7 +693,7 @@ namespace DotRecast.Detour.TileCache
|
||||||
bmax[2] = header.bmin[2] + (header.maxy + 1) * cs;
|
bmax[2] = header.bmin[2] + (header.maxy + 1) * cs;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getObstacleBounds(TileCacheObstacle ob, Vector3f bmin, Vector3f bmax)
|
void getObstacleBounds(TileCacheObstacle ob, ref Vector3f bmin, ref Vector3f bmax)
|
||||||
{
|
{
|
||||||
if (ob.type == TileCacheObstacle.TileCacheObstacleType.CYLINDER)
|
if (ob.type == TileCacheObstacle.TileCacheObstacleType.CYLINDER)
|
||||||
{
|
{
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class TempObstaclesTest : AbstractTileCacheTest
|
||||||
MeshTile tile = tiles[0];
|
MeshTile tile = tiles[0];
|
||||||
Assert.That(tile.data.header.vertCount, Is.EqualTo(16));
|
Assert.That(tile.data.header.vertCount, Is.EqualTo(16));
|
||||||
Assert.That(tile.data.header.polyCount, Is.EqualTo(6));
|
Assert.That(tile.data.header.polyCount, Is.EqualTo(6));
|
||||||
long o = tc.addObstacle(new float[] { -1.815208f, 9.998184f, -20.307983f }, 1f, 2f);
|
long o = tc.addObstacle(Vector3f.Of(-1.815208f, 9.998184f, -20.307983f), 1f, 2f);
|
||||||
bool upToDate = tc.update();
|
bool upToDate = tc.update();
|
||||||
Assert.That(upToDate, Is.True);
|
Assert.That(upToDate, Is.True);
|
||||||
tiles = tc.getNavMesh().getTilesAt(1, 4);
|
tiles = tc.getNavMesh().getTilesAt(1, 4);
|
||||||
|
|
Loading…
Reference in New Issue