Detour - findNearestPoly fails menu

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detour - findNearestPoly fails

    Hi guys,

    im currently working on a navmesh implementation and exported Azeroth in tiles as obj files and exported them as a navmesh.

    My mesh config:
    Code:
              m_cellSize = 0.35f;
             m_cellHeight = 0.3f;
       
             m_agentHeight = 1.652778f;
             m_agentRadius = 0.2951389f;
             m_agentMaxClimb = 1.0f;
             m_agentMaxSlope = 50.0f;
       
             m_regionMinSize = 20;
             m_regionMergeSize = 40;
       
             m_edgeMaxLen = 12.0f;
             m_edgeMaxError = 1.3f;
       
             m_vertsPerPoly = 6.0f;
             m_detailSampleDist = 3.0f;
             m_detailSampleMaxError = 1.25f;
    And I use this code to load the mesh and calculate the path:
    https://github.com/tomrus88/capek/bl...v/CapekNav.cpp

    In RecastDemo the navmesh is successfully loaded and path creation works just fine.
    In the FindStraightPath function from the above code it everytime fails on 'findNearestPoly'.
    dtStatusSucceed is true but mesh->isValidPoly(poly) isnt.

    Somebody got an idea whats wrong?

    Detour - findNearestPoly fails
  2. #2
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In RecastDemo you made changes to actually load the mesh itself? And not the raw indices/vertices/normals?

    What does isValidPoly return when it fails?
    https://tanaris4.com

  3. #3
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for your answer Tanaris...

    Originally Posted by Tanaris4 View Post
    In RecastDemo you made changes to actually load the mesh itself? And not the raw indices/vertices/normals?
    In RecastDemo I select the obj File and load the mesh for it with the load button (modified the load button).
    So basically the only difference between RecastDemo and my attempt is, I dont load the associated obj the navmesh is created from.

    Originally Posted by Tanaris4 View Post
    What does isValidPoly return when it fails?
    Like I said, dtStatusSucceed returns true on findNearestPoly and but isValidPoly returns false, m_startRef and m_endRef is returned null.

  4. #4
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What is the entire return value? Print them out to console. It may have the success flag but there could be other flags in there as well hinting @ problems.
    https://tanaris4.com

  5. #5
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    What is the entire return value? Print them out to console. It may have the success flag but there could be other flags in there as well hinting @ problems.
    Now I understood what you mean...

    The content of status is 1073741824 everytime, what means DT_SUCCESS and only DT_SUCCESS :S

  6. #6
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you loading the correct tiles? If it can't find the nearest poly that means the mesh doesn't actually have any information for the given coordinate. Verify that the start/from are actually in that tile.

    Here is how I determine which tiles to load, then I call basically the same function you are using:

    Code:
    - (NSArray*)routeFrom:(Position*)startPos to:(Position*)endPos status:(dtStatus*)status{
    
        PPNavmeshQuery *query = [[PPNavmeshQuery alloc] init];
        NSString *meshPath = [[@"~/Dropbox/Meshes/Azeroth" stringByExpandingTildeInPath] stringByAppendingString:@"/"];
    
        PPCoords *start = [[PPCoords alloc] initWithPosition:startPos];
        PPCoords *end = [[PPCoords alloc] initWithPosition:endPos];
    
        float NavMeshOri[3];
        NavMeshOri[0] = -(32 * GRID_SIZE);
        NavMeshOri[1] = -(32 * GRID_SIZE);
        NavMeshOri[2] = -(32 * GRID_SIZE);
        int startTileY = (int)(((-(start.pgX)) - (-(32 * GRID_SIZE))) / GRID_SIZE);
        int startTileX = (int)(((-(start.pgY)) - (-(32 * GRID_SIZE))) / GRID_SIZE);
        int endTileY = (int)(((-(end.pgX)) - (-(32 * GRID_SIZE))) / GRID_SIZE);
        int endTileX = (int)(((-(end.pgY)) - (-(32 * GRID_SIZE))) / GRID_SIZE);
    
        //NSLog( @"Start tile: (%d, %d)", startTileX, startTileY);
        //NSLog( @"End tile: (%d, %d)", endTileX, endTileY);
    
        int x1, x2, y1, y2;
        if ( startTileX <= endTileX ){
            x1 = startTileX;
            x2 = endTileX;
        }
        else{
            x1 = endTileX;
            x2 = startTileX;
        }
        if ( startTileY <= endTileY ){
            y1 = startTileY;
            y2 = endTileY;
        }
        else{
            y1 = endTileY;
            y2 = startTileY;
        }
    
        // load a square for now (one tile behind each)
        for (int x=x1-1; x<=x2+1; x++){
            for (int y=y1-1; y<=y2+1; y++){
                if ( ![query addTile:[NSString stringWithFormat:@"%@%d_%d.mesh", meshPath, x, y] andX:x andY:y] ){
                    NSLog(@" not found...");
                    continue;
                }
            }
        }
        NSArray *coords = [query routeFrom:start to:end status:status];
        NSMutableArray *positions = [NSMutableArray array];
    
        // convert and add
        int index = 0;
        for ( PPCoords *coord in coords ){
    
            Position *pos = [Position positionWithX:coord.pgX Y:coord.pgY Z:coord.pgZ];
    
            [positions addObject:pos];
    
            NSLog(@"%i: %@", index++, pos);
        }
    
        return [[positions retain] autorelease];
    }
    Yes I know it looks weird, it's objective-C (I'm a mac developer), but it should still make sense.

    PPCoords is just a class that lets me switch between the wow coordinate system and what detour uses.
    https://tanaris4.com

  7. #7
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    Are you loading the correct tiles?
    Yes I am, but I kind of think Im creating the navmesh the wrong way.
    I just call saveAll at the end of handleBuild in RecastDemo.
    Mesh settings are the one I posted above and this are my params:
    Code:
    dtNavMeshParams params;
    float GRID_SIZE = (533.0f + (1.0f / 3.0f));
    params.tileWidth = GRID_SIZE;
    params.tileHeight = GRID_SIZE;
    params.orig[0] = -(32*GRID_SIZE);
    params.orig[1] = -(32*GRID_SIZE);
    params.orig[2] = -(32*GRID_SIZE);
    Started by shikyo, 1 Week Ago
    params.maxTiles =  4096; // 5000 was suggested but i cant init the navmesh why?
    params.maxPolys =  1024; // 10000 was suggested but i cant init the navmesh why?
    Im creating the navmeshes from obj files coming out of wowmapper...
    Im exporting one obj for each adt and trying to create one navmesh for each adt
    Last edited by Edder; 02-08-2012 at 04:17 PM.

  8. #8
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you post a screenshot of what the meshes look like when loaded on top of the .obj files in RecastDemo? That should help us narrow down the issue quite quickly Or post a mesh file w/the appropriate .obj file.
    https://tanaris4.com

  9. #9
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Tanaris,

    thank you for your support, I'll will post an obj file and a navmesh file later...

    Theres something else I dont understand, when using the params posted above, RecastDemo isnt able to create path, I have to use the stock settings
    Code:
            dtNavMeshParams params;
            rcVcopy(params.orig, m_geom->getMeshBoundsMin());
            params.tileWidth = m_tileSize*m_cellSize;
            params.tileHeight = m_tileSize*m_cellSize;
            params.maxTiles = m_maxTiles;
            params.maxPolys = m_maxPolysPerTile;
    Im confused right now and wanna know where my mistake is, in navmesh creation (working with R&D) or did I even exported my obj the wrong way...
    I know you can skip the object file creating task, but I wanted something to see in RecastDemo, to debug my navmesh if neccessary :S
    Too see if theres a door missing etc.

  10. #10
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can't really help you until I see those files - then we'll know immediately :/

    Also, if you're using libmpq, you won't be exporting ALL the data you need, but probably 98% of it. You will be missing some things as libmpq doesn't support patched MPQ files, you need to use stormlib.
    https://tanaris4.com

  11. #11
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Tanaris4 View Post
    Also, if you're using libmpq, you won't be exporting ALL the data you need, but probably 98% of it. You will be missing some things as libmpq doesn't support patched MPQ files, you need to use stormlib.
    Does this count for MPQ's from client 3.3.5a, too? Cause I only work with 3.3.5a...

    Here the obj File and navmesh File for Tile 32_48 -> Filebeam - Beam up that File Scottie!

  12. #12
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Can you show me a mesh around it? Don't need the .obj file Like 32_49 or something?
    https://tanaris4.com

  13. #13
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here the navmesh from 32_47 and 32_49 -> Filebeam - Beam up that File Scottie!
    Hope that helps

  14. #14
    Tanaris4's Avatar Contributor Authenticator enabled
    Reputation
    148
    Join Date
    Oct 2008
    Posts
    646
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've run into similar problems, can you post your entire build function? Here is how yours looks:


    Definitely not right Here is how it should look:


    Edit: My image may look different due to mine being live vs. 3.3.5, but same concept
    https://tanaris4.com

  15. #15
    Edder's Avatar Active Member
    Reputation
    22
    Join Date
    Dec 2008
    Posts
    77
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The build function of the navmesh or obj file?
    The navmesh build function is basically the same as in recastdem, I only change the rcConfig Values to the one I posted above.
    This is the code from wowmapper I use to create the obj file: #include "../src/mpqhandler_c.h" #include "../src/chunks/wdt/wdt_c.h" #include - Pastebin.com

    edit: I tested it one more time, and it doesnt even work in recastdemo without the obj file loaded, it seems that the navmesh only works when the corresponding obj is loaded...

    edit2: it seems to work now, dont know what was wrong but im able to generate a path if the start and end pos is on the same tile, how to generate a path when start is on 32_48 and end on 32_49 ?
    I tried to add the tiles of the other navmesh files, but it seems they are overriding the old ones :S
    Last edited by Edder; 02-11-2012 at 04:51 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. Server connection failed!
    By dromeztah in forum World of Warcraft Emulator Servers
    Replies: 3
    Last Post: 10-08-2007, 03:38 PM
  2. How do you fix "The app failed to initialize properly(0xc0150002)"?
    By explode13 in forum World of Warcraft Emulator Servers
    Replies: 1
    Last Post: 08-30-2007, 07:34 PM
  3. My own try,failed...
    By Mysti- in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 07-20-2007, 11:51 PM
  4. funny failed backflips
    By Sacrifice in forum Screenshot & Video Showoff
    Replies: 0
    Last Post: 07-14-2007, 12:18 PM
  5. Few model changes. please help :) , tryed self and failed
    By luddo9 in forum WoW ME Questions and Requests
    Replies: 12
    Last Post: 07-04-2007, 12:32 PM
All times are GMT -5. The time now is 07:34 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search