ikpil / DotRecast

DotRecast - a port of Recast & Detour, Industry-standard navigation mesh toolset for .NET, C#, Unity3D, games, servers
zlib License
563 stars 72 forks source link

System.ArgumentException:“'0' cannot be greater than -1.” #60

Open 6ther opened 8 months ago

6ther commented 8 months ago

my code like this: var indexs = new List<int>(){ 7, 0, 1, 2, 3, 4, 6, 7, 1, 2, 4, 5, 5, 6, 1, 1, 2, 5}; var verts = new List<float>(){17307.352, -13128.241, 4000, 17307.352, 5071.7583, 4000, -8892.649, 5071.7583, 4000, -8892.649, -8428.24, 4000, -4592.6494, -8428.24, 4000, -4592.6494, -928.24164, 4000, 8307.351, -928.24164, 4000, 8307.351, -13128.241, 4000, 17307.352, -13128.241, 4000 }; SimpleInputGeomProvider geomProvider = new(verts, indexs); RcVec3f bmin = geomProvider.GetMeshBoundsMin(); RcVec3f bmax = geomProvider.GetMeshBoundsMax(); RcContext m_ctx = new(); RcConfig cfg = new( RcPartition.WATERSHED, m_cellSize, m_cellHeight, m_agentMaxSlope, m_agentHeight, m_agentRadius, m_agentMaxClimb, m_regionMinSize, m_regionMergeSize, m_edgeMaxLen, m_edgeMaxError, m_vertsPerPoly, m_detailSampleDist, m_detailSampleMaxError, true, true, true, new RcAreaModification(0x2, 0x07), true); RcBuilderConfig bcfg = new(cfg, bmin, bmax); RcBuilder rcBuilder = new(); RcBuilderResult rcResult = rcBuilder.Build(geomProvider, bcfg); it throws System.ArgumentException:“'0' cannot be greater than -1.” I don't know how it caused it?

6ther commented 8 months ago

planeXunlu.txt 1709085981350(1) I clone the codes, and use my file to test. it also throws System.ArgumentException:“'0' cannot be greater than -1.”

ikpil commented 8 months ago

image

ikpil commented 8 months ago

image

ikpil commented 8 months ago

Because the 3D model is incorrect. It seems like the coordinate system was misaligned when exporting to obj.

@6ther

6ther commented 8 months ago

Because the 3D model is incorrect. It seems like the coordinate system was misaligned when exporting to obj.因为3D模型不正确。导出到obj时,坐标系似乎未对齐。

@6ther

I modify the coordinates system of the 3D model, and retry. It throws System.IndexOutOfRangeException : Index was outside the bounds of the array. planeXunlu.txt

6ther commented 8 months ago

xunlu2.txt I use this file to test. It also throws System.IndexOutOfRangeException : Index was outside the bounds of the array. In a word, I do not know what is wrong with my coordinates.

6ther commented 8 months ago

1709285056763 I use a right hand coord system, the Z-axis is up. Like in the picture, it is a platform. I want to generate NavMesh on the upper surface, but it does not work and throws System.IndexOutOfRangeException : Index was outside the bounds of the array. I have no idea.

ikpil commented 8 months ago

Too Big! image

ikpil commented 8 months ago

image

ikpil commented 8 months ago

It's true that it's too big, but I'll try to reduce memory usage related to RcSpan.

6ther commented 8 months ago

It's true that it's too big, but I'll try to reduce memory usage related to RcSpan.它确实太大了,但我将尝试减少与RcSpan相关的内存使用。

Thank you for taking the time out of your busy schedule to answer my questions.