Jump to content

Navmesh: Is it possible to set up "conditions" for pathing?


Recommended Posts

Good afternoon everybody!

 

I know that you can select certain triangles in the navmesh and make them "preferred pathing", so that NPCs will use those instead of just a "striaght line" to where they want to go.

 

But is it possible to have conditions for that "preferred pathing"?

 

Like for example have only certain NPCs access an area and others not.

Or if a certain quest stage is reached, have a different "group" of triangles in the navmesh getting set as the "preferred pathing" ...

 

I mean every navmesh triangle has its own "ID" so maybe a script could "interact with them" in the described way ... ?

 

 

Because as far as I understand it, Navmesh gets used to tell NPCs "this is a 'walkable surface'".

So everything that NPCs should be able to walk on should get navmesh'ed.

But how would you make a "non-enclosed area" (so not an interior cell) only be acessible to certain NPCs?

Link to comment
Share on other sites

The only tool I know for "disabling" a certain part of the navmesh is a navcut.

A navcut is a trigger or a collision cube (maybe others) in which L_NAVCUT is set as collision layer in its properties (primitive tab).

 

 

PS: Note that you can enable/disable triggers and collision boxes with scripts.

Edited by DieFeM
Link to comment
Share on other sites

Ok, so, I could make a triggerbox that, on entry, checks if an NPC is "allowed to go further" (by checking for a keyword, faction or whatever) and if the NPC "shall not pass", enables a NavCut-thing that will "block the way".

 

Right?

 

(This could get messy when two or more NPCs walk into the triggerbox at the same time ...)

Link to comment
Share on other sites

It would get messy pretty soon certainly, I think that a proper set of packages would be a better solution. You could use as many refCollectionAlias as paths, and setup a package for each collection, so you can use the trigger to add the npcs to the desired collection so they use the package that leads them one way or the other.

Link to comment
Share on other sites

Ok, but another problem that I have with the NavMesh thing:

 

The "preferred pathing" should be used to mark roads, paths, basically any "proper way".

An NPC will always go the "shortest route" from A to B, using the preferred pathing if possible.

Alright:

 

But what if I had a small dirt path that would be the "shorter way" from A to B, but I want the NPCs to use the actual "road" (which is a longer way)?

How would I set that up?

 

Because all the roads and small dirt paths HAVE TO BE preferred pathing, otherwise the NPCs start walking across the countryside ...

Is there something like "preferred preferred pathing"?

Like a "priority system" for the different "preferred paths"?

Link to comment
Share on other sites

And not forgetting that pathing only happens when Actors are "onscreen" in the active uGrids with rendered (if you will) navmesh.

 

Once the actors/navmesh are offscreen outside of the active ugrids, they revert to straight line XYZ coordinate pathing from present position to destination. Sort of.

 

ps If your gonna do per actor packages the most elegant solution is to apply an actor value to the actor and make that actor value value a package condition to manage a single stack.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...