Following the recipe for dtTileCache but can't get dynamic obstacles to work menu

User Tag List

Results 1 to 2 of 2
  1. #1
    gobsmack's Avatar Member
    Reputation
    1
    Join Date
    Dec 2024
    Posts
    6
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Following the recipe for dtTileCache but can't get dynamic obstacles to work

    Looking at the loadAll code form Sample_TempObstacles.cpp in Recast Detour, I'm pretty much using that setup but having no effect on the path finding. Does findStraightPath work with obstacles?

    I even carefully checked the references of the obstacles, and they just say the state is PROCESSING even after calling tileCache->update.


    Hopefully you have gotten past this point and can offer some insight. Thanks.

    Following the recipe for dtTileCache but can't get dynamic obstacles to work
  2. #2
    gobsmack's Avatar Member
    Reputation
    1
    Join Date
    Dec 2024
    Posts
    6
    Thanks G/R
    1/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have this then it init's the navQuery, adds the obstacle (converted to RD coords), and finally update tileCache

    Code:
    void loadAll() {
    	dtTileCacheAlloc* talloc = new LinearAllocator(32000);
    	dtTileCacheCompressor* tcomp = new FastLZCompressor();
    	MeshProcess* tmproc = new MeshProcess();
    
    	std::string path = dir + "0.bin";
    	FILE* fp = nullptr;
    
    	// Open the file
    	if (fopen_s(&fp, path.c_str(), "rb") != 0 || !fp) {
    		printf("Error opening file: %s\n", path.c_str());
    		return;
    	}
    
    	// Read header.
    	size_t headerReadReturnCode = fread(&header, sizeof(TileCacheSetHeader), 1, fp);
    	if (headerReadReturnCode != 1)
    	{
    		// Error or early EOF
    		fclose(fp);
    		return;
    	}
    	if (header.magic != TILECACHESET_MAGIC)
    	{
    		fclose(fp);
    		return;
    	}
    	if (header.version != TILECACHESET_VERSION)
    	{
    		fclose(fp);
    		return;
    	}
    
    	alt_navMesh = dtAllocNavMesh();
    	if (!alt_navMesh)
    	{
    		fclose(fp);
    		return;
    	}
    	dtStatus status = alt_navMesh->init(&header.meshParams);
    
    	if (dtStatusFailed(status))
    	{
    		fclose(fp);
    		return;
    	}
    
    	m_tileCache = dtAllocTileCache();
    	if (!m_tileCache)
    	{
    		fclose(fp);
    		return;
    	}
    	status = m_tileCache->init(&header.cacheParams, talloc, tcomp, tmproc);
    	if (dtStatusFailed(status))
    	{
    		fclose(fp);
    		return;
    	}
    
    	// Read tiles.
    	for (int i = 0; i < header.numTiles; ++i)
    	{
    		TileCacheTileHeader tileHeader;
    		size_t tileHeaderReadReturnCode = fread(&tileHeader, sizeof(tileHeader), 1, fp);
    		if (tileHeaderReadReturnCode != 1)
    		{
    			// Error or early EOF
    			fclose(fp);
    			return;
    		}
    		if (!tileHeader.tileRef || !tileHeader.dataSize)
    			break;
    
    		unsigned char* data = (unsigned char*)dtAlloc(tileHeader.dataSize, DT_ALLOC_PERM);
    		if (!data) break;
    		memset(data, 0, tileHeader.dataSize);
    		size_t tileDataReadReturnCode = fread(data, tileHeader.dataSize, 1, fp);
    		if (tileDataReadReturnCode != 1)
    		{
    			// Error or early EOF
    			dtFree(data);
    			fclose(fp);
    			return;
    		}
    
    		dtCompressedTileRef tile = 0;
    		dtStatus addTileStatus = m_tileCache->addTile(data, tileHeader.dataSize, DT_COMPRESSEDTILE_FREE_DATA, &tile);
    		if (dtStatusFailed(addTileStatus))
    		{
    			dtFree(data);
    		}
    
    		if (tile)
    			m_tileCache->buildNavMeshTile(tile, alt_navMesh);
    	}
    
    	fclose(fp);
    }

Similar Threads

  1. [Bug] Can't get it TurboHUB to work
    By littlemcnab in forum TurboHUD Support
    Replies: 0
    Last Post: 05-12-2020, 03:17 PM
  2. [ArcEmu] Please Help - Can't get multiple realms to work
    By pennwhip in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 06-15-2010, 10:39 AM
  3. [Question] Can't get mont edits to work help please!
    By Cheesesteak in forum WoW ME Questions and Requests
    Replies: 9
    Last Post: 08-15-2008, 05:30 PM
  4. Can't get skin swap to work
    By homer_3 in forum WoW ME Questions and Requests
    Replies: 0
    Last Post: 04-05-2007, 08:38 PM
All times are GMT -5. The time now is 09:00 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search