Navmesh on a spherical planet

Yes,I just want to make ‘ASTAR_RECAST_LARGE_Tiles’ false so that I can use the mesh whose vertices more than 4095.But where is the ‘Additional Defines ’,I cant see it in PlayerSettings.

You need to scroll down.
It’s called Scripting Define Symbols these days apparently.

image

Thank you.Can I specify that some ‘Graphupdateobjects’ only work on a certain layer, for example,‘Graphupdateobjects’ of radius 0.5 only works on Navmeshgraph1, and’ Graphupdateobjects’ of radius 1 only works on Navmeshgraph2? :flushed: :worried: I use ‘AstarPath.active.UpdateGraphs(guo)’,but it seems to be modify all graphs those in the A* PathFinder inspector

You can use

// Only update graph index 0
guo.nnConstraint.graphMask = 1 << 0;

// Only update graph index 1
guo.nnConstraint.graphMask = 1 << 1;

:heart_eyes: :heart_eyes: :heart_eyes: Ah,now I’m beginning to believe that I can solve the problems I’ve encountered! :grinning: Thanks!

Hi,Aron, at present I have used the ‘GraphUpdateObjects’ to ‘bake’ a obstacle on sphericial world(as long as each triangle is small enough,it’s enough for me) :smile: And now I want to use this method to realize ‘dynamic obstacle’,for example,this time my player will take down a box on ground and its ‘GraphUpdateObjects’ collider will overwrite ‘guo.setWalkbility=false’, then next time my player move the box to a far position its ‘guo.setWalkbility=true’, it is better to achieve the function like sliding door.Here is my code,but I dont think this is a good idea,because when I update the graph in runtime the frames will drop by several seconds(And is there any way to increase the speed of ‘UpdateGraphs’? )Or is there any ‘asnyc’ method to ‘UpdateGraphs(guo)’ ,then when updating graphs the game will not be stuck ? :hushed:


Hi,Aron,for solving the frames dropping when UpdateGraphs(guo),I have tried to put this method into a thread,but it will come an exception "UnityException: get_isPlaying can only be called from the main thread.Constructors and field initializers will be executed from the loading thread when loading a scene.
Don’t use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function. " So I want to ask you does A* pro have an async method for ‘UpdateGraphs’?


Hi

It looks like you are updating every single collider every time you need to update the graphs. Is this really necessary?

The navmesh graph cannot be updated asynchronously I’m afraid. You can spread the update out over several frames by only scheduling a few graph updates per frame (and using FlushWorkItems every frame). However this will also prevent pathfinding from running a large portion of the time.

OK ,I will try it.And can I take ‘AstarPath.active.UpdateGraphs’ in a thread to update the graph(Is this a way to solve this situation too)? :flushed:

Dont need to every frame,I will set a varible(0.2s-0.5s) to update the graphs. :fearful:

Hello,Aron,I have try to use ‘FlushWorkItems’ in my codes.but it seems can not solve the problem of ‘Screen Stucking’ when ‘UpdateGraphObjects’,do I use it uncorrectly? Or is there a link or a case to teach me how to use ‘FlushWorkItems’? :hushed:

Hi

Do you need to update all of the objects every 0.2-0.5 seconds? Are all of them moving at the same time?

Also. You cannot use threading in that way. The API is not thread-safe I’m afraid.
It will use threads behind the scenes for some graphs, but not for navmesh graphs as they have some other requirements.

I want to update the objects which is rolling on the ground and something like sliding door on the ball,and I think update them every 0.2-0.5f is OK.How can I solve this problem(It happens that the spherecial world need navmesh graph)?

Hi,Aron,If current version can not update navmesh graphs asyncally or can not solve it in a thread(my version is 4.3.11 pro),can you expand some methods for hanling it?(I have spent several days to try to solve it but finally I cant :flushed:)I really need help :flushed:

Hi

Navmesh graphs cannot be updated in a separate thread without some significant changes to the package I’m afraid.
I would suggest that you either try to reduce the frequency with which some objects update the graph or to reduce the number of objects that you need to move.

But the question is that even through I just have only one obstacle to use ‘UpdateGraphs’,the game will also be stucked by several seconds which will reduce the game enjoying. :flushed: :flushed: Do you have other method to solve it(or even if relieve it is enough for me now ). :fearful:

Hello Aron,Is there any api to clear the old path or clear the agent data?Becauce when the agent reaches the pos and then update next desitination to patrol ,and I use ‘if(aipath.reachDestination==true)’ to judge if agent arrive the new pos,it will get true even the agent not reach.

@aron_granberg Hello Aron,I’m looking for a solution to path finding on a spherical world as well which brought me here.

How can I make object perpendicular to sphere surface and lookat Target?
I already replace script to AIArbitrarySurface

my A* Pathfinding Project version : 4.2.17.

Thanks for your answers.

@aron_granberg hello I want to make the pathfinding on a spherical planet in Unreal Engine.can you send your code about the the pathfinding on a spherical planet. thx :heart_hands:

@Chuxi_Yang I don’t think there’s any specific code from this package that will help you in Unreal, I’m afraid.