Tell me more ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Update 10/03

Ok, so i figured out the problem. C# is a funny old language..I changed

    int navMeshCount = navMesh.GetPath(ref start, ref end, routePolys, navMeshRoute, false);

to

    var navMeshCount = navMesh.GetPath(ref start, ref end, routePolys, navMeshRoute, false);

and finally im getting the pathfinding values to work!

When i debug the routeNavMesh array fills up with the values i require.

http://i.imgur.com/QgH8UL6.png [Screencap of debug in question]

Ill update again once im done.


Having some major problems getting a navigational mesh to work, in particular i cant get it to do any pathfinding or get it to respond to my vector3 input in any useful way.

Im working on the sunburn engine, it sits on top of XNA 4.0, so all of XNAs functions are still usable.

Recently Recast Navigation from digesting Duck's blog was ported over to c# and i've used it to create navigation meshes for my levels. Here is a link to the tutorial/guide i've been trying to follow: http://xboxforums.create.msdn.com/forums/p/109484/647991.aspx

im not sure how to pass in the start and end values on the getpath segment, are these meant to be values in world space or object space or something? If i do vector3 values and enter them as the start and end values( and then subsequently set them in a place on the array), i dont get an array of values that shows path finding, i just get those two verbatim values inside the navmeshroute array.

Here is where i try and run the path, its in my Update.

        routePolys = new ushort[dtStatNavMesh.MAX_POLYS];
        navMeshRoute = new Vector3[dtStatNavMesh.MAX_POLYS];


        if (ks.IsKeyDown(Keys.L))
        {

            if (!runOnce)


            {
                start = new Vector3(0, 0, 0);
                end = new Vector3(1000, 0, 1000);
                ppos = x;

                navMeshRoute[0].X = start.X;
                navMeshRoute[0].Y = start.Y;
                navMeshRoute[0].Z = start.Z;

                navMeshRoute[count].X = end.X;
                navMeshRoute[count].Y = end.Y;
                navMeshRoute[count].Z = end.Z;


                int navMeshStart = 0;

              navMesh.GetPath(ref start, ref end, routePolys, navMeshRoute, true);


                Console.WriteLine("navMeshPC" + navMesh.getPolyCount());

                int navMeshCount = navMesh.GetPath(ref start, ref end, routePolys, navMeshRoute, true);

                while (navMeshStart < navMeshCount)
                {

                    routeNode = navMeshRoute[navMeshStart++];

                }



                Console.Out.WriteLine("NMc : " + navMeshCount);

            }
        }
share|improve this question

closed as too localized by Byte56, Sean Middleditch, bummzack, Tetrad Mar 12 at 20:13

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, see the FAQ.