diff --git a/src/DotRecast.Detour.TileCache/TileCache.cs b/src/DotRecast.Detour.TileCache/TileCache.cs index 5efc943..3a18853 100644 --- a/src/DotRecast.Detour.TileCache/TileCache.cs +++ b/src/DotRecast.Detour.TileCache/TileCache.cs @@ -358,7 +358,7 @@ namespace DotRecast.Detour.TileCache } // Cylinder obstacle - public long addObstacle(float[] pos, float radius, float height) + public long addObstacle(Vector3f pos, float radius, float height) { TileCacheObstacle ob = allocObstacle(); ob.type = TileCacheObstacle.TileCacheObstacleType.CYLINDER; @@ -457,7 +457,7 @@ namespace DotRecast.Detour.TileCache CompressedTile tile = m_tiles[decodeTileIdTile(i)]; Vector3f tbmin = new Vector3f(); Vector3f tbmax = new Vector3f(); - calcTightTileBounds(tile.header, tbmin, tbmax); + calcTightTileBounds(tile.header, ref tbmin, ref tbmax); if (overlapBounds(bmin, bmax, tbmin, tbmax)) { results.Add(i); @@ -501,7 +501,7 @@ namespace DotRecast.Detour.TileCache // Find touched tiles. Vector3f bmin = new Vector3f(); Vector3f bmax = new Vector3f(); - getObstacleBounds(ob, bmin, bmax); + getObstacleBounds(ob, ref bmin, ref bmax); ob.touched = queryTiles(bmin, bmax); // Add tiles to update list. ob.pending.Clear(); @@ -682,7 +682,7 @@ namespace DotRecast.Detour.TileCache 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; 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; } - void getObstacleBounds(TileCacheObstacle ob, Vector3f bmin, Vector3f bmax) + void getObstacleBounds(TileCacheObstacle ob, ref Vector3f bmin, ref Vector3f bmax) { if (ob.type == TileCacheObstacle.TileCacheObstacleType.CYLINDER) { diff --git a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs index e544fc1..29fda75 100644 --- a/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs +++ b/test/DotRecast.Detour.TileCache.Test/TempObstaclesTest.cs @@ -46,7 +46,7 @@ public class TempObstaclesTest : AbstractTileCacheTest MeshTile tile = tiles[0]; Assert.That(tile.data.header.vertCount, Is.EqualTo(16)); 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(); Assert.That(upToDate, Is.True); tiles = tc.getNavMesh().getTilesAt(1, 4);