#🤖┃ai-navigation

1 messages · Page 6 of 1

idle flax
#

mainly just doing sampleposition so that if the player is on top of an object that the navmesh agent cannot get to, the agent doesnt just stop and instead goes to the closest position on the navmesh to the player

fathom arch
idle flax
#

oh hmm

fathom arch
#

Seems like Navmesh.Raycast would be more reliable there

#

Although if your map is super simple it might not make much difference

#

I'd use the Navmesh one anyway

idle flax
#

essentially what the raycast is trying to do is try to move the object further away back

#

but now i realize that if the terrain is curved, this wouldnt work

fathom arch
#

Yeah exactly

idle flax
#

but NavMesh.Raycast would also not work on curved terrain right?

#

wait it might

fathom arch
#

It does, that's the whole point

#

IIRC you should still snap it with SamplePosition afterwards

idle flax
#

let's see

#

gonna have to check if the sampleposition even works

#

i think i know the issue, the terrain is very much elevated, but i'm setting the destination y to 0
i should project it onto the navmesh instead

#

is there a way to do so without using sampleposition?

#

actually i dont think i need to set the y to 0 or anything else at all

#

yup, that worked :D

pale notch
#

hey i made a project that randomly generates an infinite backrooms like structure using gameObjects prefabs that i use as tiles. How can I get a dynamic navmesh without losing too much performance?

radiant palm
pale notch
#

ok so the navmesh for the tile will be generated and be like in the prefab?

#

and the link at runtime?

pale notch
radiant palm
radiant palm
#

id imagine you’d be generating the links based off of code - as I don’t think the components connect navmesh surfaces together automatically

pale notch
#

Well I imagine generating the links lags the game a bit

#

Also I checked and i cant do multithreading with that

#

Im probably gonna use Aron Granberg's A* Pathfinding Project

#

The free version of course

pale notch
young mist
#

Any thoughts on how to get NavMeshSurface auto-generated links as bi-directional?

young mist
#

Feels silly that it's not supported by default

still knot
#

hey Everyone , in my game all my objects that are for environment I marked static , but still my navmesh agent is going through them somehow , how can i solve this

still knot
#

yup

#

tried decreasing voxel size too

chilly phoenix
#

Id really appreciate some help
when my agent switches to attack state it sometimes just kinda goes on a waddle off somewhere before finding its way to the player

i think its to do with these parameters is there an "ideal" set of values to set for really good tracking on the player and not so much worry about obstacles or something

weak vector
#

is there a way to train ai to play any unity game?

molten sequoia
weak vector
#

Any suggestion to what type of server I should ask on?

night oasis
#

why wont my navmesh go up these stairs. each individual step is smaller than the step high assigned and the collider for the steps (a slope) has a smaller angle than max. Ive even tried using modifier but they dont affect the navmesh at all

night oasis
#

It was the mesh for some reason it works now

manic fog
#

is there a way to make my agent not cut corners like this? or maybe make it more "robotic" in a way i guess?

tardy junco
winter pond
#

Well, can anyone please suggest me a good behavior tree asset that is free? i can't use unity's behavior package because my project is on 2021.3, its really hard to upgrade at this point of my project.

night oasis
near warren
#

Does anyone know a model i can use to identify two difference peoples voices, and then tell me, which person is talking into the mic on unity. been trying to figure this out using sentis, and importing models, but i just cant get it to work, and i cant find anyone who has done it before.

smoky pivot
#

Hey guys I am able to bake the area , but the line renderer doesn't show the line

#

What can I do

tardy junco
maiden wolf
#

Does someone know why the floor is all squiggly? My navigation works, properly despite this hiccup on the visual of the navmesh

#

I'm guessing it is probably the format of the collider that is a 3d shaped box that is too tall for these floor tiles

sweet ore
amber flint
#

This NavMesh Agents looks interesting for FPS games...

But what about side-scrolling games? Like platformers. Where enemies should drop down, or jump up to chase you. (Think of super smash bros maps)

How can this be implemented for that?

#

I managed to use it, but to make it jump to other areas... I use links, that makes them jump - differently than players - and i want to create bots that play very similar to humans. Guess its too much to ask lol

sweet ore
# amber flint I managed to use it, but to make it jump to other areas... I use links, that mak...

Honestly it sounds like the kind of problem I would solve without a NavMesh. NavMeshes are meant to find generic 2-dimensional paths on surfaces, but on a side-scroller, every surface is 1-dimensional.

But with platform links you're on the right track. You still want that element of pathfinding to determine which jumps to do to get from A to B. However I think a good approach here is to implement a node-graph system that contains platforms as nodes and jumpable gaps as edges. If you don't have hundreds+ platforms you can just throw in a naive Djikstra's search to find which path to take.

PS: Since you already seem to have it working with NavMesh you could extract the "path" information from the NavMeshAgent instead of re-implementing the above.

Either way, to make it work more "like a player" I think you would need some code to execute the jump properly, which is a bit of a physics challenge with calculating when to jump and with what running speed if that's variable. There are probably several ways to do this depending on how the jumps are done in the game.

amber flint
#

The player (cyan smiley) got in enemy (purple skull) target sight and got away to the right. And jumped in the platform above.

The enemy if it stayed behind, it tries to follow below the player - same X location, different Y.

If i could "leave breadcrumbs" from the player then enemy would know the player went to the red circle and then link to jump above and continue following.

And this is 2.5D game. Means you can move in X and Y. And there's also Z to "change lanes". Its a bit of a twist in my game.

sweet ore
# amber flint "just throw in a naive Djikstra's search to find which path to take." What is t...

If breadcrumbs works well enough for you then that's an okay solution. I think the original Unreal Tournament used "apples" to help their AI move around maps.

Djikstra is a basic type of path-finding algorithm. There is also A* (A-star) which is better but more complicated - and unneccesary for simple cases. So basically Djikstra searches for ways to get from A to B in a "node graph" (See screenshot) to find the shortest/quickest way to get there.

In your case, a "node graph" would just mean a list of platforms (node), where each platform has links (edge) to other platforms where it's possible to jump. In essence what Djikstra does (Simplified explanation) is to:

  • Start at the current platform (of the enemy)
  • Check all links from current platform to other platforms
    • Check if any of them is the "goal" (The platform where the player is)
    • (Djikstra would prioritize the ones that are closest first)
  • Otherwise, repeat this process but pretend the enemy starts on the neighbor platforms this time. (And skip the original platform, no need to go back and forth)

So each "repeat" expands the search to the next platforms. And when it finds the player, then it should report what platforms it searched to in order to get there. And now you can make the enemy start moving in that direction.

#

(If you don't care about which path is the "shortest" then a "Breadth-First-Search" is simpler yet to put in code)

#

So here's an illustration for how the process would be (Enemy is red star, tries to reach player who is green star):

  • Breadth-First Search will first check if the first jumps (Burgundy colored lines) will reach the player. If not, check if secondary (orange) jumps reach the player. If not, check if third jumps (Red lines) reach the player, and so on.
  • Djikstra's would also check how far the enemey has to move for each jump and always check the shortest options first. For example a long platform could take more time to walk than doing 3 jumps on another route.

If this sounds overly complicated you can explore other options, but both of these should be easy to google and find example code for. Specially the BFS code is probably just a dozen lines long as long if you have the platforms/links configured (which makes out "the graph" in this case)

dim plover
#

I have a big problem with navmesh agent unity. I have used nav mesh agent in my 2d game to move characters. The problem is when the destination is not in nav mesh (it is in a hole navcut), they can find a valid path and move to it! I have checked the characters' nav mesh agent. The property auto traverse off mesh link is unticked, also, the jump area mask has not been included in the layer mask. What is the problem?

#

In editor, I see red dot lines from the character to the target in the hole

amber flint
# sweet ore If breadcrumbs works well enough for you then that's an okay solution. I think t...

Oh i love this! I believe another name for this is Waypoints. And this is definitely what i wanted to implement... Dont have C# knowledge for that, and AI couldnt help lol and couldnt find a platformer waypoint asset for that.

But this is the best solution because my game will have capture flag / invade or defend base.

So enemies when they are not chasing a player, they will go to the other side of the map for the objectives.

Waypoint when following player
Waypoints to get to the other side

So these are called Node Graph?

Wondering how to use visual script for this hmm 🤓

sweet ore
#

Yeah if waypoints are linked then you essentially have a node graph - correct.

maiden wolf
#

the view of my game is orthogonal, top down, if that makes a differenece

sweet ore
# maiden wolf the view of my game is orthogonal, top down, if that makes a differenece

No worries, it's just if it just looks bad because there are two overlapping meshes (floor tile and nav mesh) then typically that causes the rendering engine to not know which one should be visbile on top of the other, and you get flickering.

But if the mesh works and you're able to walk on the entire surface, whether it's blue or white, then it's safe to assume it's just visual.

I might also add that I had issues with using NavMesh on "Quad" meshes in the past, while both "Cube" and "Terrain" meshes work fine. Not sure if that's related.

maiden wolf
dim plover
#

No, you cannot set the NavMesh Agent radius to zero in Unity, as the minimum allowed value is 0.05f.
Why? What is the reason for that? With zero radius, nav mesh will be simpler and less polygons

muted void
#

Hello, I am trying to modify a path of my agent by changing corners positions. In debug and visualization the points are changed correctly, they retain their Z coordinate (I am working in XY plane with NavMeshPlus on top of built-in NavMesh) and they all lie on the NavMesh. Then I try to run agent.SetPath(newPath) which returns true. The newPath as I said is set up correctly, I do double check it and yes it is modified. But the agent's path remains untouched like nothing happened. I tried temporarily disabling/stopping the agent, I checked paths million times visually, through VS debug and console. I spend hours googling it but only found one unsolved post with the same issue. Is it not possible to set your own path despite having SetPath function?

wooden pawn
#

Hi, what is the correct way to do if I moved the racking, how do I recalculate the path or will it be expensive?

radiant palm
rigid dome
#

how do i make my navmesh go backwards

#

my agent

#

nevermind i got it

shadow moon
#

What system could be used to make enemies dynamically clear an area without predefined patrol points?

tardy junco
shadow moon
tardy junco
#

In the simplest form, you could just loop all the enemies on the map, get the closest one and tell the agent to move somewhere around that position.

#

Or even simpler, just let it move to a random position on a map. That's gonna be chaotic, but might satisfy your needs.

#

If you don't have waypoints, you need some other way to provide the agent with a target destination. As for what way exactly, it's entirely up to you and your project.

shadow moon
shadow moon
#

There exists a navmesh, that's pretty much all you're working with

tardy junco
#

If you generate the level procedurally, perhaps there is some logic that identifies rooms in it. You could use that info to place markers or something.

shadow moon
#

Not procedural

#

The idea here is that the enemies clear rooms like in real. You know, checking the corners, etc

#

All I can think of is placing clear markers parented under designated rooms that the AI will have to go through in order to clear it well

tardy junco
shadow moon
#

Generative AI running a background algo for every enemy in the game 😆

#

Jesus. I'll just mark the rooms. Thanks

shadow moon
#

I need help with the technical part of my AI. So how do they actually move? Right now I have a character controller setup and WASD/Mouse control.

#

Say I mark a point on the nav mesh for him to go to. I don't quite understand how that translates into the same control as you would have with a mouse and keyboard

#

I dunno, this is a pretty silly question. But I see games like Tarkov where the AI is basically just players posessed by an FSM - they look around, sprint, move in nonlinear ways, etc

tardy junco
#

For example, generating a path via the navmesh, but moving the character along it manually by adding forces or applying velocity

wet walrus
#

hi, i'm wondering with the ai navigation stuff in U6, is it possible to have something like automatic map recognition?
(sorry bad explanation lmao)
like if i had randomised map layouts, would it be possible for it to recognise it without any issues or would i have to make my own map recognition?

tardy junco
wet walrus
steady grail
#

my ai boss is spinning around like a bey-blade half the time, the other half he is falling through the floor, i use a navmesh agent which is a child component of his, aswell as a character controller and a rigid body , none of my other ai characters act like this, only him - any insight is greatly appreciated

autumn patrol
#

why is my agent getting permanently stuck on this corner? it seems to be trying to go right and left simultaneously and is getting stuck

#

why doesnt it follow the path normally?

tardy junco
autumn patrol
# tardy junco Does it have a path?

im not too sure what you mean by this. it has a target and behaves normally everywhere else, but it gets stuck on this staircase area for whatever reason

#

if the target for this agent is standing close to it, it will be normal

tardy junco
autumn patrol
#

yeah the path keeps alternating every other frame

#

oh actually its a problem with my code, never mind 😅

maiden wolf
#

Hey, I'm kinda confused, Why does the Nav Mesh Agent makes an collision outline that goes below the ground?

#

It was just a matter of centering the character in the Character Controller! nevermind

frank spear
#

I want them to be able to surround the player in a group, or find points to kinda "hang back" from while other enemies attack the player, stuff like that

tardy junco
tardy junco
frank spear
frank spear
keen pasture
#

is there a way to override the agent rotation? i want to make movement and look direction of an npc independent on certain moments (like a strafe behaviour), and for now i'm just using LookAt to override the whole gameObject rotation to look at my target, so i was wondering if it's possible to do something similar without altering the Transform directly

tardy junco
#

Or whatever it was called

keen pasture
frank spear
heavy sage
#

my navmesh isnt baking and sources say 0

autumn patrol
#

why is this selection greyed out? what does that mean?

heavy sage
#

im using navmeshplus and it's giving me an error NullReferenceException: Object reference not set to an instance of an object
UnityEngine.AI.NavMeshSurface2d.CalculateGridWorldBounds (UnityEngine.Matrix4x4 worldToLocal) (at Assets/NavMeshPlus-/NavMeshComponents/Scripts/NavMeshSurface2d.cs:487)
UnityEngine.AI.NavMeshSurface2d.CalculateWorldBounds (System.Collections.Generic.List`1[T] sources) (at Assets/NavMeshPlus-/NavMeshComponents/Scripts/NavMeshSurface2d.cs:448)
UnityEngine.AI.NavMeshSurface2d.UpdateNavMesh (UnityEngine.AI.NavMeshData data) (at Assets/NavMeshPlus-/NavMeshComponents/Scripts/NavMeshSurface2d.cs:233)
UnityEditor.AI.NavMeshAssetManager2d.StartBakingSurfaces (UnityEngine.Object[] surfaces) (at Assets/NavMeshPlus-/NavMeshComponents/Editor/NavMeshAssetManager2d.cs:124)
UnityEditor.AI.NavMeshSurfaceEditor2d.OnInspectorGUI () (at Assets/NavMeshPlus-/NavMeshComponents/Editor/NavMeshSurfaceEditor2d.cs:295)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass79_0.

heavy sage
#

hello?

molten sequoia
#

There is no "NavMeshSurface2d", It was removed few month ago.
h8man on Apr 24, 2023

heavy sage
#

i reverted to a previous version of navmeshplus

#

is it not compatible with unity anymore or something

molten sequoia
heavy sage
#

i see

#

i just found it in a post somewhere online

#

so i should use navmeshsurface

#

instead of 2d

violet wyvern
#

is it possible to manually modify NavMesh Triangulation via code?

tardy junco
heavy sage
#

i cant see my navmesh

#

it should be blue

#

i tried rotating xy

#

and not rotating

#

and also it says sources 0

#

i have 4 navmesh agents

#

all static

heavy sage
#

hellooooo

grizzled tapir
#

how do i make an ai agent takepaths that are not visible to my player?(if such a path is available)
(using simple raycasts to check visibility)

#

i want my agents to hide, but in the process of moving to a hidden location sometimes they take paths that go right in front of the player which defeats the whole purpose 😔

night drum
heavy sage
#

my navmesh surface isnt showing the blue area after i try to bake

#

and it says sources 0

verbal basin
#

Hey all. I'm in the middle of a game jam and am running out of time, but I ran into the bug with some nav mesh agents. I have them patrolling right now, but they're generating weird paths to get to certain points:

#

there aren't obstacles in the way, the nav mesh is a flat surface. Any idea what could be causing it?

uneven current
# verbal basin

show navmesh surface gizmos/blue + anything relevant, like code and inspector for agent

verbal basin
#
            /*Checks if the robot is in attack distance. 
             If it is, the robot stops
             If it is not, it checks to see if it has a path towards the player
                if it does, it moves toward the player
                if it does not, it stops chasing and returns to it's marching path*/
            if (distanceFromPlayer < AttackDistance)
            {
                agent.isStopped = true;
                stateManager.attacked = true;

            }
            else
            {
                agent.isStopped = false;
                if (!agent.hasPath && calculatePath)
                {
                    cameraAlerted = false;
                    calculatePath = false;
                    spottedPlayer = false;
                    agent.destination = marchTarget.position;
                }
                else
                {
                    if (drone)
                        agent.destination = new(target.position.x, transform.position.y, target.position.z);
                    else
                        agent.destination = target.position;

                    calculatePath = true;
                }
            }
        } 
        else if(spottedPlayer)
        {
            framesBlindedFor++;
        }
        else
        {
            framesBlindedFor = 0;
            agent.destination = marchTarget.position;
        }```
#
if (transform.position == marchTarget.position)
        {
            if (currentMarchNum == marchingOrders.wayPointTransform.Length -1)
                currentMarchNum = 0;
            else
                currentMarchNum++;

            marchTarget = marchingOrders.wayPointTransform[currentMarchNum];
        }```
uneven current
#

also would play around with stopping distance and use. <= for distance check rather than == , a bit more room to work with than approximate to 0

#

would up the acceleration and rotation speed too

verbal basin
shadow moon
#

Hey

#

I have this issue. My nav agent radius is quite thin, and he constantly hugs the corners of walls

#

Every time the nav tries to wrap around a tight edge, it snags him and slows down

#

How can I make the movement more natural, in that it prefers to go to the middle of whatever doorway/hallway its in?

#

I am not using the navmeshagent's movement and overriding it with CharacterController,

#

I don't want to just increase the radius of the agent because that will prevent him from being able to access certain areas

heavy sage
#

my navmesh wont show in 2d mobile projects

#

after i bake

#

it works in other types of projects

novel notch
#

yo im getting some errors on the end of my training run in mlagents its telling me i dont have the oxxn model installed even tho i have it installed

#

im not sure if this is a version error like wrong unity verson or python or if i just have it wrongly installed

#

everything else works just i cant get the ai brain model

wraith basin
#

Is there a way to just assign a section of a navmesh to a different area mask? e.g. if I've got a cylinder that intersects the navmesh, can I just get that intersection and change the area mask? I've got a building system where the placed blueprints should be passable and not part of the navmesh, but builders shouldn't stand inside of what they're working on.

If not I guess I could just procedurally generate "work sites" based on the mesh for the object being constructed and have workers stand in those lmao, that's probably simpler in terms of execution

shadow moon
#

Why do my navmesh corners generate 0.08m above the surface they're baked on?

#

I can even see that the surface has an offset. This is bad. I do not want this.

#

I saw online that clicking Build heightmesh fixes this, but it does not

shadow moon
#

I am not using NavMeshAgent. I am calculating the path with NavMesh.CalculatePath

cinder tulip
#

But why not use navmeshagent?

raven rapids
#

Just soved an annoying problem, and I thought I'd briefly share...

#

I'm using NavMesh.CalculatePath to compute paths in my map

#

I (incorrectly) assumed that the default agent type's ID was 0

#

so I did this

#
new NavMeshQueryFilter {
  areaMask = NavMesh.AllAreas,
  agentID = 0
}
#

The result: area cost was ignored!

#

It still found a valid path, but the path was suboptimal

#

I thought I was having problems with nav mesh links at first, but then I discovered it was always pathing wrongly

dark wind
#

hello, i've got an AI agent which for some reason doesnt reach certain points when for example too far away, it just returns an incomplete path:

    private bool TrySetDestination(Vector3 worldPos, float sampleRadius = 3f)
    {
        var _reusablePath = new NavMeshPath();
        
        if (!NavMesh.SamplePosition(worldPos, out var hit, sampleRadius, NavMesh.AllAreas))
        {
            Debug.LogWarning($"Given path is not reachable to: {worldPos} due to sample not reached!");
            return false;
        }
        
        if (!agent.CalculatePath(hit.position, _reusablePath) /*||
            _reusablePath.status != NavMeshPathStatus.PathComplete*/)
        {
            Debug.LogWarning($"Given path is not reachable to: {worldPos} due to path not being complete, {hit.position}");
            return false;
        }
        
        agent.SetPath(_reusablePath);
        return true;
    }
#

most of the time it returns Given path is not reachable to: {worldPos} due to path not being complete

#

this is the map the agent has to move on

#

i've made sure every area is reachable

#

and in fact it is

#

but for some reason when then specified point to reach is far away it simply returns an incomplete path

dark wind
shadow moon
subtle drift
#

Hello, I've been working on my game, and I'm working on a state machine for my killer AI in my game, but I just feel like it's weird and clunky and I don't really know what I'm doing, can anyone help?

tardy junco
subtle drift
heavy sage
#

Can you have multiple pathfinder objects in a scene

raw flint
neon breach
#

Hi, guys! My agent works bad on some surfaces and i cant figure out what is a problem. These surfaces seems to be the same and i even swapped it but some agents seems to be lagging no matter of a surface. I thought, maybe the problem is in objects around, but i deleted it all and nothing changed.
Code is pretty simple:

if (playerTrackerScript.targetPlayer && playerTrackerScript.targetLocked && playerTrackerScript.distanceToTargetPlayer > 2f)
{
    if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Attack"))
    {                      
         agent.SetDestination(playerTrackerScript.targetPlayer.position);       
    }
}

The code is rinning in Update. However, if i set destination only once, it seems better, but i need to update it in order enemy to follow the player.

granite spire
#

Is there a way how to incentivise the AI to walk through a normal path aka like in the middle and not the corners. Cuase my enemy keeps on getting stuck on corners cause he's sticking to the wall instead of using normal pathways

wise jay
slate hound
#

how do i increase the white outline

slate hound
#

i want the non walkable part to be more like this, how do i achieve that?

wise jay
#

increase the agent radius

queen fable
#

Hey,
How can I make the interior be accessible by the AI please ? Like it's seperated from the main part of the navmesh because of the Text so I don't know how to make Unity understand that the text shouldn't interfere with the patfinding 😬

uneven current
queen fable
uneven current
queen fable
uneven current
queen fable
# uneven current the floor, the walls etc.

I'm using the Voxel Plugin which handles that automatically at runtime, here the issue is regarding my gameobjects that have a text child, for some reason it's considered by the navmesh while it's supposed not

tardy junco
tardy junco
queen fable
tardy junco
#

No. It's a component

queen fable
tardy junco
tardy junco
queen fable
tardy junco
queen fable
tardy junco
#

No

#

Please open and read the docs...

queen fable
granite spire
#

I'm working on a racing game and I want to have AI Drivers but when I give the the different points to go to they're picking the shortest path possible and cramming together how can I make the driving feel natural

granite spire
#

I have this race track each piece has a navmesh surface script with walkable selected, a box collider and they are static. They are custom meshes but when I bake them they don't create a surface to move the AI on

granite spire
#

It seems like my blender meshes can't receive the surface

queen fable
#

Could blackboard listen to events coming from a ScriptableObject or a C# script please ? If yes, how please ?

granite spire
#

wait I found how this new system works

peak acorn
#

SOLVED by ownRotation script.

Hello, does anyone here have experience with A* pathfinding project PRO version?
I don't know why but it behaves differently for me compared to gameView and when I have split scene/gameView ... once I have split everything works correctly, but as soon as I click cleanly into Game view, my enemy either doesn't rotate or rotates badly, I really don't know. I can't deal with it anymore. Using richAI + Seeker
attached video -> https://ctrlv.tv/VuXv

rigid dome
#

why is my navmesh like that

buoyant latch
#

I'm making a patrol system for this enemy and I've put a series of patrol points and it goes correctly towards them and everything is going well but I don't know why sometimes it gets stuck in the middle of the route, I have the transitions fine, all the decoration seen in the image has the Navmes Obstacle and the walls are static, they have static activated, I don't know why sometimes he gets stuck and doesn't know what to do. I'm using a ghost that the enemy follows so the movements are more natural.

buoyant latch
#

This is solved now

tardy junco
#

Use logging and visual debugs as well as info in the inspector or the ide debugger.

buoyant latch
#

it was nonsense

#

But thanks

#

I had forgotten to activate a thing in the inspector hahaha

charred venture
#

Hey everyone,
I've tried search and the last answer was in 2023 LOL
Does anyone know if "NavMeshBuilder.UpdateNavMeshDataAsync" is broken or has any known issue?
I've asked in the Untiy Discussion and no answer from any staff or anyone. I have a script that is supposed to bake only part of my navmesh (through bounds and navmesh data), but it does not seem to work.
Even worse, if I use it, it erases my navmesh data in realtime. The only option is to keep using "async" with (example) "navMeshSurface.UpdateNavMesh(_navMeshSurface.navMeshData);" which is not really good, because it syncs the whole scene.
Thanks in advance.

blazing talon
#

Hi all

I'm working on an endless runner game (fast paced) and I want to add some enemies using Navmesh. The game is player position based (the player moves and the world segment spawn accordingly). So I want to know that if there any better way to bake Navmesh surface for better performance on mobile? Please help me

tardy junco
#

This doesn't sound related to navigation. #1202574086115557446 is the appropriate channel. Make sure to provide more details, as it's not clear what kind of model you're using and what you mean by "give a list of valid words"

mortal umbra
#

anyone worked with large open world? If so then how you resolved large map navmesh?
im doing isometric game btw. As in 3D isometric terrain

#

anyway just normal game map

#

but being split into chunks or something

#

reattaching them even for seamless pathing

#

one thing to note i am not using agent for movement

#

doing NavMesh.Calculate with a lot of custom behavior

steep mulch
#

Hello, I have a question on ML agents, as I am starting out i want to know if certain things are possible.
I want to train an AI live with the player (everytime the AI dies it learns to respond to player actions) but im afraid it takes too long, so I decided to simulate a player and have that bot train my AI over a longer period of time.

Question part: I was planning to save policies of the training every few episodes and use those as a "rank-up" system where everytime the AI is reinstated it will progress to the next "better trained" policy.
Actual Question: Does Unity ML-Agents allow me to save the training values every x episodes?

tardy junco
simple ravine
#

im using nav mesh where the agent runs away from the cat but it always gets stuck in the corner, how do i make it so it goes along the wall?

alpine glacier
simple ravine
# alpine glacier You need to provide more details. And also fix the problems in console

this is the code the agent uses:
using UnityEngine;
using UnityEngine.AI;

public class newNavScript : MonoBehaviour
{
public Transform player;
public float fleeDistance = 5f;

private NavMeshAgent agent;

void Start()
{
    agent = GetComponent<NavMeshAgent>();
}

void Update()
{
    Vector3 directionAway = transform.position - player.position;
    Vector3 fleeTarget = transform.position + directionAway.normalized * fleeDistance;

    NavMeshHit hit;
    if (NavMesh.SamplePosition(fleeTarget, out hit, 5f, NavMesh.AllAreas))
    {
        agent.SetDestination(hit.position);
    }
}

}

#

but when it runs into a corner, it gets stuck

#

if you could give me the answer, that would be helpful. thanks

alpine glacier
#

You're directing it to the to the opposite direction of the cat, so theres no where else to go after it hits a dead end (like the corner) unless you redirect again.
You're gonna have to have some sort of corner checking logic, there are multiple ways to do that so it depends on what you want

simple ravine
#

i want him to run across either the left or right wall. i tried but wasnt successful. all i did was make him alternate from cat to wall continuously

alpine glacier
#

What did you try

simple ravine
#

i tried so many things in code. i cant remember

#

i tried to make him avoid the wall and the cat at the same time

#

but it just alternates

alpine glacier
#

I have an idea, ill do it in Unity to see if it works and then ill tell you

simple ravine
#

ok thanks.

simple ravine
#

This problem seems to be harder than I initially thought

alpine glacier
#

Yeah me too lol.
So I tried corner checking and so on, the problem is that it will just keep going along the walls.
You're gonna need some smarter AI, not one that just blindly goes in the opposite the direction, because this will cause it to go the borders of any map unless the player specifically guides it away @simple ravine

simple ravine
#

Yeah. Thanks for helping anyways

simple ravine
#

if anyone else has the answer, pls help!

winter fjord
#

hi how can i learn basic ai navigation for 2d

tardy junco
pulsar waspBOT
#

:teacher: Unity Learn ↗

Over 750 hours of free live and on-demand learning content for all levels of experience!

winter fjord
#

for 2d

tardy junco
#

You will need to use a third party asset, like the A* project.

molten sequoia
molten sequoia
#

You can use this sort of logic to combine the goals of moving to that map point and avoiding danger.

avoidanceMovement = directionAwayFromDanger * dangerAvoidanceWeight * (1f - distanceToDanger / distanceToBeginDangerAvoidance)
finalMovement = navigationMovement + avoidanceMovement```
glacial marsh
#

im in Unity 6 HDRP, trying to reference a NavMeshSurface component, which apparently requires:

using UnityEngine.AI.Navigation;

but that isnt found, anyone know what it needs to be?

glacial marsh
#

NVM, VS was being silly

midnight cairn
#

yo so im trying to put a navmeshsurface on a tilemap but failing to do so (I think because tilemap is not mesh) so i tried to put colliders and use physics colliders instead of render meshes but that doesnt work either. Could someone help and tell me if its possible to find a solution? Thank you. I am intending the floor tilemap to be walkable and the wall one to not be but its not working for either. The blue map thing doesnt show. Any help would be appreciated thanks

#

Oh and ita version 2021.3.something the one with long term support

tardy junco
midnight cairn
#

do you have any ideas

#

I just sort of want the enemy to follow the player without banging into a wall

tardy junco
midnight cairn
#

ok thank you

vagrant wasp
#

hi, I've been experimenting with behaviourtrees. after changing something in one of my action scripts this happened in the BT viewport view:

#

I can no longer see any of the nodes incl. start node

#

but the nodes must still be there somewhere because the behaviour tree still works during runtime

#

I also get this error when the BT window is open:
NullReferenceException: Object reference not set to an instance of an object Unity.Behavior.ReflectionElement+<>c.<CreateFields>b__5_0 (System.String variableName, Unity.Behavior.GraphFramework.SerializableType type) (at ./Library/PackageCache/com.unity.behavior/Authoring/UI/AssetEditor/Nodes/ReflectionElement.cs:50)
I can't create any new nodes

#

additionally, I tried reverting back to before I made the change that caused this in my version control but the issue persists

vagrant wasp
#

I think this was because I tried changing the action story via script... note to self, set it in the inspector otherwise it irreversibly corrupts the entire BT

trail trench
#

hi 🙂
any idea why that just wont work?
i use the default bake for it.
it consists of 3 gameobject, all static, all have a box collidor.

tardy junco
trail trench
#

What is a Good Solution?

tardy junco
# trail trench What is a Good Solution?

Change the navmesh settings(step height), or lower the object so that it's surface is on the same level as the rest of the ground, or exclude the object from the bake.

reef stream
#

trying to make a pacman ghost entity, where it snaps to rotate around the maze. But it slows down on every corner it reaches even with angular velocity maxed and stopping distance turned off. Should i manually code the rotation? is this a common problem with navmeshes?

mystic stirrup
#

is there a built in setting to make a NavMeshAgent only finish the path if its looking at the path target location?

So lets say its 1 unit away from the path, with a stopping distance of 2 units, but the end point is behind it, so it'll move to rotate regardless of its stopping distance so it looks at it as well

if not, what would be an effective way to do it?

tardy junco
somber frost
#

Hi gang I remember looking into this 2/3 years ago and there wasn't anything amazing but if I were to use navmesh agents in an rts style game where players can say... place buildings that need to be pathed around what's the best way to go about this?

#

I think I remember some extra package that meant you can regenerate the navmesh at runtime is this still a good option?

rigid imp
somber frost
#

that seems awfully simple and I'm very confused why I didn't find this when I tried it before

#

even made a forum post

regal lagoon
#

Hello. I use NavMeshAgent + Root Motion to move it with animation. I change the position of the object, but this means that it won't collide with the environment and with other agents. What should I do?

vagrant wasp
#

having a painful issue with BehaviourGraphs and Navigation where the Behaviour logic just gets... stuck, seemingly randomly

pictured is the behaviour logic, its currently evaluating the branch as false, which according to my understanding, means that the tree should just restart since the node terminates that branch

#

and it does do that as expected but sometimes it just hangs here for seemingly no reason

#

also, the navmeshagent just stops moving when this happens even though it currently has a valid target position

#

like the entire prefab just freezes or something

#

I've just remade the behaviour graph thinking it was my logic but it still happens even though there's no issue with the logic at all

#

very frustrating

pine valve
#

what up so i have an issue right here, why is the orange target thingy showing to that location?

#

that cube thing should go to the player

#

player is the red capsule

#

nvm i solved it somehow lol

dusty arch
#

Heyo!

I'm trying to implement a pawn system kind of similar to how unreal handles PlayerControllers, Pawns and AIControllers in order to have a shared movement set between players and AI. So I need to kind of "extract" the path from a NavMeshAgent.

Vector3 desiredVelocity = navMeshAgent.desiredVelocity;
Vector3 normalizedDirection = new Vector3(desiredVelocity.x, 0f, desiredVelocity.z).normalized;

CurrentPawn.ReceiveInput(new MovePawn
{
     Direction = new Vector2(normalizedDirection.x, normalizedDirection.z)
});

Currently I'm setting the NavMeshAgents updatePosition and updateRotation to false and only using it to get a path to follow, which I then extract using the desiredVelocity, it works perfectly fine and the AI follows the target as it should but it seems to be ignoring the obstacle avoidance radius causing it to get stuck on edges and sides of objects. I've considered using the static NavMesh.CalculatePath but would really like to keep the Unity built in path-smoothing and obstacle avoidance if possible. Does anyone know of a way I could cause the NavMesh path to still avoid other agents and obstacles while not strictly using the Agent?

real void
#

I am watching a youtube Unity AI Navigation Basics tutorial. They are talking about AI 2.0 Navigation samples but I can't seem to find them.

lofty sequoia
#

Hi! Can anyone help me? My agent have agent.autoTraverseOffMeshLink = false;

When he touches nav mesh link, he stucks on it. If i reset path, put another destination or try to warp him out of offmeshlink, he buggs and not moving.

Why this happening, anyone?

empty flame
#

All of my AI Gizmos such as NavMeshLinks, NavMeshObstacles and NavMeshSurfaces are Super Transparent and barely visible. How can i change the Transparency of those gizmos?

grand turret
#

hey guys, I am on Unity 6 and i am having issues with navmesh navigation. I have a script which makes navmesh in runtime since I am using procedural generation, it fully works in the editor but when I try to build it does not bake properly, giving my agents an error. Does anyone know why this is the case? I've never encountered an issue where something works in editor but not in build

For context I am using Unity 6 and here is my runtime baking code:

using UnityEngine.AI;
using Unity.AI.Navigation;
using System.Collections;
using Mirror;

public class RuntimeNavMeshBaker : MonoBehaviour
{
    [Header("NavMesh Surface")]
    [SerializeField]
    [Tooltip("Reference to the NavMeshSurface component.")]
    private NavMeshSurface navMeshSurface;

    [Header("NavMesh Baking Settings")]
    [SerializeField]
    [Tooltip("Time in seconds to wait after dungeon generation before baking the NavMesh on the server.")]
    private float waitSeconds = 2.0f; // Default delay for server

    /// <summary>
    /// Public method to initiate NavMesh baking.
    /// For clients, waits until the expected number of dungeon objects are spawned.
    /// For server, uses a fixed delay.
    /// </summary>
    public void BakeNavMeshAtRuntime(int expectedObjects = -1)
    {
        if (navMeshSurface == null)
        {
            Debug.LogWarning("[RuntimeNavMeshBaker] NavMeshSurface reference is missing!");
            return;
        }

        StartCoroutine(BakeNavMeshWithDelay(expectedObjects));
    }

    /// <summary>
    /// Coroutine that handles the delay or waiting condition before baking the NavMesh.
    /// </summary>
    /// <param name="expectedObjects">Number of dungeon objects to wait for on clients. -1 for server.</param>
    /// <returns>IEnumerator for coroutine.</returns>
    private IEnumerator BakeNavMeshWithDelay(int expectedObjects)
    {
        if (expectedObjects > 0) // For clients
        {
            Debug.Log($"[RuntimeNavMeshBaker] Waiting for {expectedObjects} dungeon objects to be spawned...");
            float startTime = Time.time;
            float maxWaitTime = 10f; // Maximum wait time in seconds
            while (GameObject.FindGameObjectsWithTag("DungeonObject").Length < expectedObjects)
            {
                if (Time.time - startTime > maxWaitTime)
                {
                    Debug.LogWarning("[RuntimeNavMeshBaker] Timeout waiting for dungeon objects, baking anyway.");
                    break;
                }
                yield return null;
            }
            Debug.Log("[RuntimeNavMeshBaker] All dungeon objects spawned or timeout reached, proceeding to bake.");
        }
        else // For server
        {
            Debug.Log($"[RuntimeNavMeshBaker] Waiting for {waitSeconds} seconds before baking NavMesh...");
            yield return new WaitForSeconds(waitSeconds);
        }

        // Proceed to build the NavMesh
        navMeshSurface.BuildNavMesh();
        Debug.Log("NavMesh baked successfully at runtime after delay.");
    }
}```
undone sedge
#

When I added a navmeshsurface to this and baked it it would set the walkable paths to the windows and other stuff and not the actually floor itself. I tried adding navmeshmodifiers and it still wouldnt do anything.

ebon sonnet
#

@everyone Hi! I was wondering how AI can be used when making a game in Unity. I feel like ChatGPT doesn't work that well for it. Does anyone have any suggestions?

torn pelican
tardy junco
undone sedge
tardy junco
#

Could be wrong, but I think that's the version where they transitioned to the dedicated navigation package with navmesh surface components.

#

Might be worth checking that.

undone sedge
fluid leaf
#

How good is the behaviour package of unity to make ai?

#

I used to code ai by getting the navmesh agent component attached to npc and calling the set destination function in scripts

#

Also can the animator be used for ai? It is a state machine I know that much, but can I attach ai related code to individual states, is that the intended use or am I doing it wrong?

molten sequoia
molten sequoia
rugged garnet
#

Is there a way to see exactly what is and isn't walkable? i'm getting some super weird pathing where it completely ignores some obstacles and not others using navmesh and also if some land is walkable but has an obstacle on top of it it should avoid the land anyway right?

#

Like it completely ignores obstacles and just jumps on top of them

fluid leaf
rugged garnet
crystal nacelle
#

hey, a question: I set the destination for agent, and the remaining distance is e.g. 2, which is correct (according to my intentions at least 😄 ) but in the very next frame that remaining distance is 0, agent is not moving (and everything falls apart). Also, stopping distance for the agent is (currently) set to 1. Any ideas why would agent stop moving in the next frame?

tardy junco
crystal nacelle
#

no the agent did not move, I know since I record desired position in separate variable and I can confirm that it is the same as agent.destionation at the beginning. Also, if something is changing agent destination it is not my code, I triple checked 🙂 but something does change it, since it is different and remaining destination becomes zero

rugged garnet
#

am I blind and just missing the shading? this is with navmesh baked

tardy junco
tardy junco
crystal nacelle
tardy junco
crystal nacelle
#

yes yes, you are right and I know that, but I am telling you that there is no other system that sets position of my object (except at spawn time, but this happens much later)

tardy junco
#

The fact that the remaining distance changes, hints that the internal position might be updated correctly, and it's exactly applying it to the transform that is the issue.

You need to confirm that by looking at the agent gizmos.

crystal nacelle
#

well... I can't see much from the gizmos, since this happens in 2 frames time... and when it's all over gizmos look "correct". And for some reason the "step" button does not work, so I can only use breakpoints, but that does not help with looking at gizmos...

tardy junco
#

When it's all over, what do you see exactly?

#

Can you take a screenshot of before and after these few frames? With the gizmos visible.

crystal nacelle
#

ok so, I set the agent destination in frame 1, in frame 2 it seems correct from breakpoint view. then in frame 3, remaining distance is 0, agent destination is the go position from frame 1, and agent is not moving.

tardy junco
#

That's not what I asked.

crystal nacelle
#

i will try to take screenshots 🙂

tardy junco
#

Another way to go about it is to visualize the agent path. Then you can step through the frames in the editor to see what's going with the remaining path frame by frame.

crystal nacelle
#

ok thanks, I will try few more things, and I will try to take screenshots, and then I might ask again 🙂

mortal umbra
#

I have this scene. How exactly I can navmesh on this blue part of the area?

tardy junco
mortal umbra
#

didnt much on youtube or other guide

#

for open world navmesh gen

tardy junco
#

Navmesh is mainly intended for fully 3d scenes, which is why there is not workflow for 2d.

#

If you're not limited to navmesh, maybe consider other navigation solutions, like the A* package.

mortal umbra
#

atleast easily

#

like if i paint water like that then automatically detected as water or sort

#

keep in mind scene is isometric game

#

might even have to improvise

tardy junco
#

!learn

mortal umbra
#

didnt got it. Some blender i have to put somewhere?? Wonder how exactly i can extract mesh out of rendered texture even or atleast other alternative....

#

basically it'll split meshes or sort?

tardy junco
tardy junco
mortal umbra
#

i mean make things in somewhere like probuilder or blender. Have separated mesh with tags then bake under a child hierarchy

mortal umbra
tardy junco
tardy junco
#

You can of course implement your own, but that would be quite a bit more complicated.

rigid dome
#

hey i need some help, say i had an npc walking around a city on pathways using the unity navmesh system, how would i get it to be able to cross streets only at cross walks and not walk across the road instead of using the pathways? But then how would i make it possible for them to do that when there in panic mode for example.

tardy junco
visual moon
#

Is there a behavior graph node that lets you append an item to a blackboard List variable? Or do I have to make an action node for it myself?

alpine rivet
#

Hey, My boss uses NavMesh2D, but only the pivot is checked for walkable area. How can I make sure the whole body stays inside?
Thanks!

hard tendon
#

Anyone here has used Behaviour graph in Unity ? It's GUI based. I have stuck in problem, where property is not visible, even though I have used [CreateProperty] attribute. Let me send the code here.

#

``public partial class SearchForThePlayerAction : Action
{
[SerializeReference] public BlackboardVariable<GameObject> Self;
[SerializeReference] public BlackboardVariable<GameObject> Player;
[SerializeReference] public BlackboardVariable<GameObject> Sensor;
[SerializeReference] public BlackboardVariable<float> WaitingTime;

[CreateProperty] public float underDistance = 2.0f; 
private Ghost ghost;
private LineOfSightSensor sensor;
private float currentTime = 0.0f;

protected override Status OnStart()
{
    ghost = Self.Value.GetComponent<Ghost>();
    sensor = Sensor.Value.GetComponent<LineOfSightSensor>();
    currentTime = 0.0f;
    return Status.Success;
}

protected override Status OnUpdate()
{
    if(currentTime < WaitingTime)
    {
        currentTime += Time.deltaTime;
        return Status.Running;
    }


    return Status.Success;
}

protected override void OnEnd()
{
}

} ``

rugged garnet
#

Kind of a weird issue i'm having, my navmesh agent cosntantly has a destination of 5.63, 0.08, 18.82 which are the co-ords of the navmesh agents location 😕

#

but when I debug.log(agent.haspath) it returns False

wary timber
#

Hello everyone I’m making a third person shooter, so I have an enemyAI. By itself it works fine (basically perfect). But when I right click and duplicate it and move another one to another location. They both just break and almost sink into the ground. This is an annoying issue and some help would be useful

tardy junco
#

You can snap objects to a surface by holding ctrl+shift and dragging the appropriate gizmo.

modest spruce
#

can someone help? my floor isn't getting anything baked onto it but small parts of the wall are. can someone help please?

random ferry
#

can you show a screenshot or vidoe how it looks now and maybe of the inspectorr too

modest spruce
#

its oging specifically on walls and i only want it on the floor

tardy junco
#

In unity y axis it up/down.

#

Assuming the gizmos are in global mode.

tardy junco
modest spruce
torn pelican
#

they observed that it was rotated

#

thats not a suggestion

tardy junco
worldly lance
#

can someone link me to a recommended solution for updating navmesh surface at runtime?
I instantiate new objects which I want to connect to my existing navmesh.

uneven current
# worldly lance can someone link me to a recommended solution for updating navmesh surface at ru...

https://www.youtube.com/watch?v=UGh4VSeKPNA

Or check out LlamaAcademy videos , he covers lots of topics on navmesh including real-time bake

In this video we’ll look at spawning in layouts and dynamically creating NavMesh surfaces during runtime, how to check when an agent has reached its, setting area costs and adding AI randomness for multiple characters.

If you want to follow along with this video, make sure to download the AI Navigation Package 2.0 from the Package Manager tog...

▶ Play video
worldly lance
#

I've seen it,
I ended up going with async update navmesh and keeping only the last 10 instantiated navmeshes, clearing the rest

weary spoke
#

Hey all, been playing around with the behavior graph system and I find it's really cool. Unfortunatley, I'm having a bit of a strange issue when trying to set the value of a vector3 blackboard variable from inside a custom node. No matter what I try, the value gets set to infinity.

using System;
using Unity.Behavior;
using UnityEngine;
using Action = Unity.Behavior.Action;
using Unity.Properties;

[Serializable, GeneratePropertyBag]
[NodeDescription(name: "Get Object Location", story: "Save [SceneObject] location to [Vector]", category: "Action/GameObject", id: "9345a4d36940e47ee4796f1bf3ef58ac")]
public partial class GetObjectLocationAction : Action
{
    [SerializeReference] public BlackboardVariable<GameObject> SceneObject = new();
    [SerializeReference] public BlackboardVariable<Vector3> Vector = new();
    Vector3 m_lastPos;
    protected override Status OnStart()
    {
        if (SceneObject is null || SceneObject.Value == null || SceneObject.Value.transform == null)
        {
            Vector.Value = m_lastPos;
            return Status.Success;
        }
        m_lastPos = new Vector3(SceneObject.Value.transform.position.x, SceneObject.Value.transform.position.y, SceneObject.Value.transform.position.z);
        Vector.Value = m_lastPos;
        return Status.Success;
    }
}
#

I've tried guarding against not having a value, I've tried saving the last know good value, I've tried most of what I can think of. The end goal was to save the last know good position of the player and to search withing a radius upon losing the player

#

Here is my behavior tree

#

Anyone have any idea what could be going wrong?

light saffron
#

calculatepath is single thread and one-shot, super expensive
is it better to increase the tile size, then?

mystic steeple
#

When i try to adjust my Agent Type radius and rebake the navmesh, my agent will slide around the map if i bump into it with my character, bouncing off the walls like an air hockey puck. When disabling the Navmesh agent, it fixes the issue. Also when setting the Agent Type radius to 0.11 or lower, it works but anything higher it begins to slide around.

currently radius is 0.11 and height is 0.24. i have the navmesh agent radius and height the same. I would like to increase it so the agent isint clipping into walls but any attempt breaks it… Anyone know a cause of why this happens?

mystic steeple
mystic steeple
#

so if i set the Nav Mesh Agent Radius to 0, it wont fly around with the Agent Type radius set to 2.0. im very confused.

buoyant latch
#

I don't know if someone could help me with a behavior tree, I'm making a boss, the player has to place 4 fragments in their 4 corresponding altars and I want that when placing a fragment, 25% of the boss's life is removed. How could I make the behavior tree scheme?

light saffron
#

OMFG peeps! you have to dump this POS unity navmesh and buy Aron's astar Pro!
250 wormies running after me and it runs on quest 2!

tardy junco
light saffron
lavish oak
#

hello,

🆘 NEED HELP 🆘

I am having problem with my nav mesh agents recognizing each other's collider boxes. Is there a way to make Navmesh agents work based on the colliders instead of the radius to avoid getting into each other?

I have few agents, each contining 10 cubes, and they have their box collider set to cover all those cubes. All agents (not individual cubes) have navmesh agent but they still get into each other when moving.

Now I know making radius bigger solves this but the radius works only in cylindrical shape and my formation is a rectangle.

Is there a way to solve this?

buoyant latch
#

Each fragment will also be linked to an elemental power of the boss. If I place the fire fragment on its corresponding altar, I want the boss to not only lose 25% of his life but also not be able to use the fire ability. I don't know if it's too complex. Maybe I should make it simpler

light saffron
#

the trick to super fast parting in unity navmesh is to lower mesh detail and have large tiles. carving is async anyway

bronze hazel
#

what does the error of "Failed to create agent because it is not close enough to the NavMesh" ?

tardy junco
shadow jungle
#

hi i have an wierd problem pls healp 🙁

spark leaf
#

are there any known relatively performance-cheap methods of getting an agent to find it's way out of simple concavities?
Right now mine is using a steering vector looking for the shortest unblocked passage to its destination (directly behind the other units) but that only works on convex obstacle arrangements

spark leaf
#

trying to find some way to help it take a shorter path UnityChanThink

quasi fulcrum
#

Attribute the distance a value and make it choose the lower value, IE if the distance between point A and B is 5 allocate it a value of 5, if the distance between A and C is 3 allocate it the value of 3 and tell it to chose the lower value etc

autumn gale
#

So i have shooter agent i want to spawn on my navmesh, but i keep getting errors when the simulation starts as the name keeps getting changed to "shooter(clone)". I want it to find the object "Shooter" I can dm ppl too as well if they want to see the script and such to discuss more in depth

quasi fulcrum
#

Any time a prefab is instantiated it is automatically prefab name(clone) try to find a component that prefab would have attached, IE a script

autumn gale
quasi fulcrum
#

Other way, create your prefab (let's call it Enemy) and in enemy as a game component you may have a script called EnemyAI, you can tell your script to find the enemy based on the script called EnemyAI

autumn gale
#

wait i still don't get it

quasi fulcrum
#

On the right, you can see a Manager script with enemy prefab. The script is attached to the Game Object, the enemy prefab also has a script attached which can run when it is spawned in

#

The script for Manager has a method that does a check for If(FindAnyObjectByType<EnemyAI>()){ Do Code }

autumn gale
quasi fulcrum
tranquil elm
#

Can you not generate a NavMesh surface with a mesh collider when using Physics Colliders? If I bake a NavMesh with these settings on this object with just a mesh collider there are no visible navmesh surfaces at all and my agent can't navigate on it

quasi fulcrum
#

You may want to play around with the settings of your navmesh, your terrain is very varied in heights and slopes, the navMesh would struggle

tranquil elm
quasi fulcrum
tranquil elm
#

Oh yeah, its just a few small patches here

#

I'll edit some more parameters and check, atleast it's generating something

quasi fulcrum
#

So that answers your original question of can you.. yes, but the terrains heights are what's maybe an issue

tranquil elm
quasi fulcrum
#

Read your yellow warnings on the bottom of the component

tranquil elm
#

Oh whoops

#

Well it still didn't work beforehand so

#

But let me fix that anyways my bad lol

#

Still the same issue, and here's a better look at the terrain mesh

#

The material is front face only so it's not a normal issue

quasi fulcrum
#

Try smoothing it out a little, low poly doesn't have to have low poly terrain too, some smoothness may help the navmesh

tranquil elm
#

I mean this is about as flat as possible which is why I was wondering iif it's a problem with mesh colliders

quasi fulcrum
#

Mesh collider is required or you'll fall through the terrain, or at least physics objects would

tranquil elm
#

Yeah I have one

#

The green outline is the shape of it so after scaling the bumpiness is definetly not an issue

#

I even tried setting the Z scale to 0 so it's just a plane but still nothing

#

Ohh wait I think I got it

#

I think the actual rotation of the object matters even if it's flat with respect to the world up vector, since if I make a box collider I get this as the baked mesh

#

So I just need to apply rotation in Blender and reexport, let me give it a shot

#

Okay yea, that worked

#

Should change my export settings next tiime

#

Thanks for the help 🙏

quasi fulcrum
#

Hey no worries, was a difficult challenge

tranquil elm
#

I kinda expected navmeshes to work with the world up so I'm surprised it works with the mesh-relativee up

jaunty elk
#

i'm very new to this, i'm using aron granberg's a* project and the setup guide is telling me to add a component called "follower entity" which just isn't there when i search for it

#

can anyone help me with this?

shadow moon
#

Is it possible to directly replace Unity's navmesh with a Mesh object?

shadow moon
# tardy junco No.

oh yeah? then what's this?

    private void Filter() {
        NavMesh.RemoveAllNavMeshData();
        List<int> newIndices = new();
        foreach (int triIndex in island) {
            for (int i = 0; i < 3; i++) { newIndices.Add(mesh.indices[triIndex * 3 + i]); }
        }
        Mesh m = new();
        m.vertices = mesh.vertices;
        m.SetTriangles(newIndices, 0);
        m.RecalculateBounds();

        NavMeshBuildSource source = new NavMeshBuildSource {
            shape = NavMeshBuildSourceShape.Mesh,
            sourceObject = m,
            transform = Matrix4x4.identity,
            area = 0
        };

        var sources = new List<NavMeshBuildSource> { source };
        NavMeshBuilder.UpdateNavMeshData(GetComponent<NavMeshSurface>().navMeshData, NavMesh.GetSettingsByID(0), sources, m.bounds);
    }
tardy junco
shadow moon
quasi fulcrum
#

You don't specifically require a navmesh to do ai navigation... It just makes it much easier.. I'd just work with navmesh than have to do all the code to handle a non navmesh surface, IE the scoring system for how difficult terrain is etc

shadow moon
#

It's pretty awful too. The workflow becomes

  1. Bake nav mesh in navmeshsurface
  2. Fidget with start randomly until it lands on a triangle that's on the island you want. (this is the point of the system, to isolate one island of nav)
  3. Click the first button
  4. Go back to the nav bake settings and change the agent radius to something ridiculously small like 0.05
  5. Apply
  6. Reset the agent radius for the next time you need it
#

This fucking sucks. All I want to do is to filter the navmesh to only keep the largest contiguous area

#

The result is also weird too. It's not what the mesh you passed in is. Minimizing the agent radius helps, but it's still a quantized version of the mesh

shadow moon
#

The other things that I use nav for are generating cover points, and generating dynamic patrol paths. I rely on the NavMesh API for stuff like find nearest point

quasi fulcrum
#

Well navmesh is a 'modern' concept. The way ai used to be run was generally a point based system
Think of it like this you have 10 points. If there is a rock in your path that is 2 points but everywhere else is 1 point, your ai works out the path that gets to the spot using the 10 allocated points (or less)

jaunty elk
#

i'm just going to use a basic patrol system with set vantage points, it's all i need for what i want

shadow moon
quasi fulcrum
#

So let's say you have a grid. We will make this grid a 3x3
xxx
xxx if we put the rock in the centre
xxx
xxx
xrx
xxx
It calculates that the rock is 2 points the rest of the path is 1 per spot
Then it would go through some quick calculations to work out the maths and if the sum total is less it takes that route

#

So you would write something that checks if distance from character to destination is less than a certain distance and it has less points than required. Take that route.
In games with followers it can adjust based on your character also why followers tend to go around a rock or take a longer route down a cliff than jumping for example

shadow moon
#

Is there genuinely no way, in Unity, to modify the nav mesh

raw flint
shadow moon
#

free engine my ass

#

Okay. Thank you

raw flint
tardy junco
alpine glacier
#

How should I go about making navmeshsurfaces for procedurally generated maps?

karmic belfry
celest lagoon
#

Couldnt you also just use navmeshobstacle?

tardy junco
#

Is this related to ai-navigation?

tardy junco
spark leaf
#

I have an a* pathfinding implementation that I am having issues getting it to return optimal paths. Almost everywhere on my map it works as expected, except for right here.
The heuristic branches out and for some reason the right-most branch is overtaking the closer left-most branch, which ultimately reaches the goal. Then I do a funnel algorithm to get a shorter tunnel through those triangles
The issue is obvious, the funnel version has this huge gap around empty passable space that would produce a shorter path is being ignored.

How can I improve it's behaviour? I can share code snippets if it helps.

#

The green path is the shorter distance, but the hscore/gscore think the red path is shorter and I cannot figure out how to make it understand that its not

wintry plaza
#

i used to have a project in 2019 (might be older... not sure (i dont have the project anymore 💔 )) which i do remember that i use the navmesh (baked scene) to create a vectoe3[] with the waypoints with the corners but i also remember that i didnt have agents on the scene.

does anyone know how to do that?

#

hi

#

i finded 😅

#

i was searching for a function with (out NavMeshPath)

#

it was dumb of my part

#

simple as that

shadow moon
#

This requires actual modification of the mesh

tardy junco
#

Or exclude the objects that would create these isles from the navmesh in the first place.

steady spade
glass marlin
#

How can I make an advanced chase AI where the AI bot has to see you to chase you?

tardy junco
worn nexus
#

how do i optimize the navigation for hundreds of agents?

shadow moon
#

God Unity's navmesh is so atrocious

#

What the hell is this

shadow moon
#

The purple points are a grid aligned even sample of the nav mesh. The green points are the patrol points dynamically generated using those points

#

Now, imagine the insides of walls, every roof, every little crevice that Unity thinks is navigable also having such a purple point

#

It completely breaks patrols

#

My little hack to make this work is atrocious. I've already detailed about it here. It works, but I feel like it constantly gets deserialized for some reason or another, and I have to restart the whole bake process again

#

That's just one system

#

My dynamic cover also utilizes the nav mesh to generate spots where the AI could go to protect itself from gunfire. It would break completely if there are hundreds of patches of unreachable nav

#

Now, could I spend several hours manually filtering out every little crevice that Unity thinks can be navved to with modifiers? Sure. I am not going to do that. This is insane, and a complete failure of Unity's navmesh system.

#

Do you know about A*? Can you tell me if it would fix my problems?

tardy junco
# shadow moon Do you know about A*? Can you tell me if it would fix my problems?

Ultimately, the issue is that you don't have a way to tell the algorithm what you want to be walkable and what not. So you'll have the same issue with A*. At least if you're gonna bake based on meshes or colliders.
Now, a simple solution that you'd use in such scenario is generate a temporary mesh of the floor only(or whatever walkable area you want) and bake the navmesh based on that. Then delete or disable it. You can have a small editor script set up that would do that and bake the mesh whenever you want.

Alternatively, you mentioned a grid. If it represents only the walkable areas, then you could probably use it in A* and not worry about anything else, though I haven't used the A* package, so take it with a grain of salt.

shadow moon
#

I cannot just replace the navmesh with the mesh I want

tardy junco
shadow moon
#

Okay? It's generating the path based off of the generated path

#

think of a thin walkway. It generates a thin nav. To filter so the nav is only that, I do some AI-generated black magic and bake again using only that surface, and now it disappears

#

You end up baking twice and the result is not great

tardy junco
#

I've no clue what you're doing and what exact issue you're facing. You'll need to share more details(screenshots or a video demonstrating the issue, code, scene setup, etc...), if you need more help on this.
What I suggested is just this:
Generate mesh of the surface via a simple script -> bake navmesh based on that mesh only.
Before that configure relevant settings correctly(like reducing the agent radius to avoid skipping of thin/small areas).

torn pelican
shadow moon
#

I bought A*. It lets me do what I actually want to do and is lightyears ahead of Unity's trash.

torn pelican
tardy junco
torn pelican
#

Overall just anecdotally I’ve had a pretty positive experience with the navmesh package. My two biggest wishes are

  1. It would be nice if it had the mesh detail available in a way where I could retrieve the mesh as submeshes based on “islands”/areas with full separation from eachother

  2. It would be really nice if we had a way to set the navmesh directly by supplying the mesh data

#

Oh actually the amount of areas allowed being a global project wise bitmask is unideal in some situations too, would prefer if it was a ScriptableObject you would plug into the surface and agents

inner summit
#

hey guys, don't know if this is the right channel but i wanted to ask if someone is familiar with unity ml agents. im trying to implement a funtionality for my thesis

shadow moon
# tardy junco Why would you need to revert them?? <:notlikethis:1068134558123442236> These set...
  1. Bake the navmesh normally
  2. Click a button on my editor script to select the island that I want
  3. Go into agent radius change to 0.00001 or some shit like that
  4. Click the button on my editor script to do the black magic on the navmesh surface, rebaking now with only the island and new character radius
  5. Go back into agent radius and revert the change to the normal character radius
  6. Reload the scene because I have to now
tardy junco
# shadow moon 1. Bake the navmesh normally 2. Click a button on my editor script to select the...
  1. Write a script that:
  • Generates the floor mesh.
  • Runs a Navmesh bake(with any param modifications if needed).
  1. Run the script.
  2. Done.

You don't need to modify the agent radius constantly. You need to set it up to a reasonable value(if you want it to walk on walkways with a radius of 0.2, the agent radius needs to be <0.2). No need to change it just for the bake. Keep it the same value all the way.

torn pelican
#

(and if you did need to adjust the agent radius, that can be done in code too)

orchid oyster
#

Hi Guys I'm trying to get the nav mesh bounds inside a behaviour agent I already have the blackboard variable but for some reason I can get the values of the navmesh inside my action script

spiral pulsar
#

You can get the NavMeshSettings easily via NavMesh.GetSettingsByID(), but how do you re-apply those changes? I want to lower the minArea in my project, but have not found a way to do so.

mighty crown
#

Hey, does anyone know why unity bakes two separate navmeshes? these two navmesh surface components (with volume) have the same settings, but still it wont bake into one navmesh, so agents can move across these platforms. Any ideas for a solution? A script would be nice, because I wanna bake them in runtime

atomic hamlet
#

hey, guys! For one reason, nav mesh surface isnt connected. Why it's happening?

sage valve
#

Hey guys, uhm, can anyone help me with runtime dynamic areas? I'm trying to get a object the player can build to work with having an area so that enemies avoid it if possible, baking works, but on runtime it will just not work

#

Like I doubt that I have to re bake the whole mesh always after placing the avoid area, thought it would work dynamically like carving from obstacle

#

But I can't figure out how

solar spruce
#

is this normal behavior for agents?
im trying to keep my agent within the 4 walls, but with a distance from the target
im brand new to this AI stuff and didnt run the training for long
but i dont think it should behave in this way

my observation and movement code is as follows

 public override void CollectObservations(VectorSensor sensor)
 {
     sensor.AddObservation(transform.position);
     sensor.AddObservation(target.position);

     for (int i = 0; i < walls.Count; i++) { 
         sensor.AddObservation(walls[i].position);
     }
     //base.CollectObservations(sensor);
 }
 public override void OnActionReceived(ActionBuffers actions)
 {
     //Debug.Log(actions.DiscreteActions[0]);

     float first = actions.ContinuousActions[0];
     float second = actions.ContinuousActions[1];

     //controller.Move(new Vector3(first, 0, second) * Time.deltaTime * walkSpeed);
     //GetComponent<Rigidbody>().linearVelocity =
     GetComponent<Rigidbody>().MovePosition(transform.position + new Vector3(first, 0, second) * Time.deltaTime * walkSpeed);
     //transform.position += new Vector3(first, 0, second) * Time.deltaTime * walkSpeed;
 }

 public override void Heuristic(in ActionBuffers actionsOut)
 {
     ActionSegment<float> actions = actionsOut.ContinuousActions;
     actions[0] = Input.GetAxisRaw("Horizontal");
     actions[1] = Input.GetAxisRaw("Vertical");
     //base.Heuristic(actionsOut);
 }
torn pelican
torn pelican
#

there might not be enough width in that doorway given those settings

#

(see how theres a gap between the nav and the walls next to the door)

mighty crown
torn pelican
#

a single navmesh surface can create a navmeshbake that affects multiple meshes

#

in most cases you only want 1 navmesh surface period

mighty crown
# torn pelican in most cases you only want 1 navmesh surface period

i have multiple room prefabs that will be used for procedural map generation. each room has its own volume of navmesh surface. the thing is when i bake them all each room as own separated navmesh baked so the agents cannot move between/across rooms. the navmeshes are overlapping at doorframes just like in the picture above (where the darker blue color is the part where its overlapping)

torn pelican
#

as far as i am aware, multiple nav mesh surfaces will never bake in a way that connects them, in your initial question you asked why that isn't happening, which is because its not something that does happen

#

I believe fairly common practice is to instantiate your rooms then use 1 navmeshsurface to bake them, either via volume area or by parenting the room instances under the navmeshsurface and either collecting them as children or colliders (based on the surface settings)

mighty crown
#

hmmm i understand :/ that sucks...

#

i am thinking of buyin a* project pro but damn 130€ is a lot

torn pelican
#

What is your problem with that method?

mighty crown
#

if i bake globally it will bake like everything, not just the areas i want yk?

#

ik a solution would be creating a separate layer for exactly these areas i wanna bake, but meh... not what i want

torn pelican
#

You might want to look at the NavMeshModifier and NavMeshModifierVolume components

mighty crown
#

OHHH OMG

#

you're right, completely forgot these

torn pelican
#

😅

mighty crown
#

didnt know there is a NavMeshModifierVolume component

#

thanks :)

quasi fulcrum
fleet badge
#

hi... can someone help me out w how to use ML agents in Unity, or suggest me some good tutorials

glacial wagon
#

Are there any obvious gotcha reasons why a baked navmesh would work differently in build than versus the editor?

#

Could this be a loading thing? Where maybe in editor the nav mesh loads first, but in the standalone build the agents are faster?

#

I'm getting Nav Mesh Agent can't find a nav mesh errors but only in standalone builds, and what DOES work is in the wrong spot

#

I'm not building a nav mesh at runtime either, this is baked in stuff

tardy junco
glacial wagon
#

I actually tried deleting and replacing it and the error persisted - but that's a good idea

#

thank you fellow lich!

torn pelican
sweet adder
#

ok thanks

cobalt oriole
#

@glacial wagon I actually had that issue in a horror game I was making. The problem was exactly what dlich said, the agent was slightly off the navmesh and snapping it to the closest point at start fixed it.

#

Of course I sat there debugging for like ~2 hours and ended up figuring that out myself. Probably wouldn't have almost ripped my hair out if I had of asked in here first haha

glacial wagon
#

You're the best 😁😁😁

lethal latch
#

NavMeshAgent Issue: Multiple Agents Following the Exact Same Path Despite Different Start Points

Hey everyone,
I'm developing a city defense game and running into a confusing issue with enemy AI pathfinding.

The Goal:
Enemies need to spawn randomly around the perimeter of the city and move toward a single, central target point (the city core). I'm using Unity's NavMeshAgent component for movement.

The Problem: Although each enemy agent is spawned at a unique, random position on the NavMesh and is assigned the same destination, they are all moving along the exact same path. They essentially form a single-file line as if they are all starting from the same position.

What I've Checked:
I verify that each agent's start position (where they spawn) is indeed unique and different.
I ensure that I am calling agent.destination = _center individually for each enemy's NavMeshAgent
The target position is a single, static Vector3 at the center of the map.

My Question:
Why would multiple NavMeshAgent components, starting from different points, calculate and follow an identical path to a single destination? Is there a scenario where agents might be accidentally sharing a path object or where the NavMesh is treating widely separated start points as the same?

Any suggestions on what to look for—especially in relation to the NavMeshAgent setup or scene hierarchy—would be greatly appreciated!

lethal latch
lucid tinsel
#

Hello there, i'm having a trouble using navmeshes.

[Context]
I'm making a block game that would have a bunch of entities, and the terrain is regrouped and generated by chunks.
Some chunks are updated quite often (a couple of times per seconds)
At first i was creating a navmesh for the whole world and re-baking it each time a chunk is updated. However it was >150ms for each baking.
Another idea I thought was to have for each chunk its own navMeshArea. However their is a small space without a navMesh area at the junction of two chunks.

[Question]

  1. Is their a way to refresh only a certain part of a navMeshArea ? (in case I only have one NavMeshArea)
  2. Is it possible to have something that could merge multiple NavMeshArea while limiting the computation time ?
lilac spire
#

When I try to bake this map, it makes a large white box around it, why is it? I know its a building but it should create a path on the grounds no? It only makes this large box around the building and no blue navmesh (script also throws me errors about invalid navmeshes)

#

Anybody can help me please? Might be the scaling? Also these are static.

honest stone
lilac spire
honest stone
#

Yeap

#

Can you go to voice?

#

@lilac spire ?

lilac spire
#

Just let me know if anybody can help me with it

past cargo
#

Okay so here's my obstacle

#

Issue I have is with this

#

The NPC which is the purple looking alien is not moving within the nav mesh surface

#

I tried a lot like baking it, using static, and almost everything I can do get it to move around the surface but it doesn't

#

If anyone can help me, that would be great!

autumn patrol
past cargo
#

That's the player character with the camera implemented

#

He told us specifically to make sure to use that parent

#

I thought that might've been a problem as well, but I don't know completely

autumn patrol
#

when you start the game and move around, you notice that the npc doesnt move at all, right? do you get any errors in your console? make sure errors are visible

past cargo
#

I do get an error about something else but it works fine. Regarding the NPC, this is what happens

autumn patrol
#

preferably convert that to an mp4

past cargo
#

Yeah my bad I forgot to do that

autumn patrol
#

video's not loading for some reason

past cargo
#

Really?

#

Let me do this then

autumn patrol
#

nvm it's working now

past cargo
#

Oh okay great

autumn patrol
# past cargo

expand your console and look for other errors. there may be more than 1

past cargo
#

Let me see

autumn patrol
#

hide everything other than errors and press collapse. then send another screenshot

past cargo
autumn patrol
#

ok that's fine

#

send your code

#

!code

visual geodeBOT
past cargo
#

Which code do I send?

autumn patrol
#

the npc movment code

past cargo
#

Okay

autumn patrol
autumn patrol
past cargo
#

Yes

autumn patrol
#

it's dogshit

past cargo
#

I don't know how to write code

autumn patrol
past cargo
#

I've used AI like chatgpt and gemini to help me with this but even they couldn't

#

But let me see if that works regarding patrol to pursuing

autumn patrol
past cargo
#

I asked how to fix this and it just told me to bake it which I've already done many times

autumn patrol
#

did you give it your code?

past cargo
#

No

autumn patrol
#

then obviously it's not gonna know that there is something wrong with the code

past cargo
#

I didn't event know there was something in the code that was messing up the project

#

Like I said, he didn't teach us coding or scripting or anything like that

autumn patrol
#

btw, you can learn coding on your own

#

there are tons of great tutorials out there

past cargo
#

I gotta look into those

#

Unfortunately, I think he's the only person who knows Unity, so they keep him

autumn patrol
#

even if that was the case, he's not teaching you anything, so what's the point

past cargo
#

TBF I've watched a lot of youtube videos and tutorials on Unity to figure this out

#

And the cc does have a game design degree that I want so I just take it in

#

Thankfully his class ends in like 3 weeks

autumn patrol
#

did my suggestion fix your problem btw?

past cargo
#

I'm trying to open visual studios with this but I don't know how to get the code to appear

autumn patrol
#

double click your script in your project

past cargo
#

Okay I think I needed to download something for unity to open with visual studios

#

My bad

#

Also thank you so much for helping!

#

You've done a lot for me

autumn patrol
#

!ide

visual geodeBOT
autumn patrol
past cargo
#

It's visual studios

autumn patrol
#

yeah then you may just need to configure your ide

past cargo
#

Alright after downloading that installer I see the code now

#

So I just save it, correct?

autumn patrol
#

yeah after changing the state, you can press ctrl + s to save

past cargo
#

Still doesn't work

autumn patrol
#

what did you change

past cargo
#

Patrol to pursuing

autumn patrol
#

send a screenshot of what your code looks like now. capitalization matters

autumn patrol
past cargo
#

Waypoint?

autumn patrol
#

where it says Waypoints, expand that, press the plus sign, and add a waypoint. you should just be able to add the player's transform in there

past cargo
#

Like this?

autumn patrol
#

yeah that should work

past cargo
#

That didn't work as well

autumn patrol
past cargo
#

That's the parent

#

That holds both the camera and player

autumn patrol
#

holy hell, your teacher's code is so bad it made me think that you did something wrong

#

nevermind my last comment, you did it correctly

past cargo
#

Here's the screenshot of the code btw

autumn patrol
# past cargo

sorry, i read the code wrong when i suggested that you needed to add a waypoint. you actually dont need it and can remove it

past cargo
#

Okay I've removed it

autumn patrol
#

you are missing a reference, but im not sure what it's supposed to be

past cargo
#

Like for the player character?

autumn patrol
#

the code is trying to access something on the head but cant

past cargo
#

Should I put the player character again on the head?

noble fog
autumn patrol
#

this code is so dogshit and this is a nightmare to look through

past cargo
noble fog
autumn patrol
#

if you can get away with it, follow a tutorial and use the code from that instead of this trash

past cargo
#

Okay so I am updating visual studios on both unity and visual studios

#

Hopefully that works but if it doesn't, I'll try to get the code from somewhere else

#

Even my teacher told me to just ask ChatGPT if there were questions

autumn patrol
autumn patrol
past cargo
#

It's strange since in his scene the NPC does actually work

torn pelican
past cargo
#

So I figured it has to be something with mines

autumn patrol
past cargo
#

I tried everything I can but it doesn't work for my scene

#

I'll try to see if I can just create or use code from somewhere else

#

Thanks for everyone trying to help!

covert hedge
#

I am having some issue with NavMesh agent always hugging the edge of the NavMesh Surface and they end up getting stuck or slowed because they keep trying to walk directly on the edge. Anyone know if there's a solution so they stay away from the edge and stay more close to the middle?

hollow cloud
#

This is to clean up what already exist but you just need to verify if the infrastructure works for it

#

Actually you can probably remove that edge from the pathing area and maybe only have it for vaulting or jumping off and only do it if you can get to the target faster... Minecraft does this... Also 7 days to die

#

If you put valuation pathing instead

#

Depends on the base infrastructure and what you want when you implement the fix

torn pelican
#

In theory you could bake with a much smaller minimum region area, sample the results and create a mesh out of it, add a navmeshmodifier to that mesh collider and then bake a second time setup so the mesh area has a lower area cost so it's preferable for agents to be more in the middle

wise pivot
#

anyone got experience using the unity behaviour tool?

#

need some help with detection

spice prism
#

Hello guys, I'm releasing City Of Light today,
This is a 3D replica of my city (Paris) for data collection and model training with embodied agent and multiple sensors,
There is a video showcacing its features available here : https://www.youtube.com/watch?v=KhIO3J9oGr8

COL leverages a new library based on shared memory segment allowing data transfer way faster than ML-Agents. I provide a bit more details in a post I created in the ressources channel !
Come there to discuss it if you are interested,

Respectfully,
Ilias

City of Light (COL) is a Unity-based, city-scale simulator of Paris built for high-throughput embodied and sim-to-real research. It fuses public geospatial data into geo-anchored 3D tiles and streams synchronized multi-sensor observations (RGB, depth, normals, semantics) to Python.

If you use COL in your research, please star the repo and cite ...

▶ Play video
rotund jacinth
# covert hedge I am having some issue with NavMesh agent always hugging the edge of the NavMesh...

The primary reason is that NavMeshes usually pathfinds on edges and vertices instead of the center of each triangle. This makes the character walk alongside the wall, as thats the path it calculated. Ya can improve this slightly by increasing the agent radius to avoid fine-grain details. You can also combine the agent with obstacle avoidance. Either by having the character separately from it's agent, and doing the movement yourself, which allows you to apply a wide range of techniques. Or you could create your own simplified agent, where your only constraints is Unity and It's Navigation library.

I recommend having a look at steering behaviors as a good starting point 🙂 https://www.red3d.com/cwr/steer/gdc99/

copper lintel
#

im making a top down simulation game and at the start the terrain has a single road going through the town and then some grass. the grass is walkable with a weight of 1 and im using a series of navmesh modifier volumes to mark the road area as road which is a value of 0.5 so the npcs favor it.

when the player starts placing their own roads down and expanding out into the grass area what's the best way for that new area to be marked as road so they prefer to use it when walking to a newly built building? my understanding is if i had a gameobject with more modifier volumes i would need to rebake each time, but that causes a noticeable hitch, so what's the best way to achieve what im looking to do? thanks

solid blaze
#

how would one check if a nav agents path Is Intersected by player line of sight

wheat scarab
#

Good evening you all! I am not familiar with AI pathfinding, I was wondering where i should start with it. Any great resources youve found useful by any chance?

noble sky
solid blaze
noble sky
solid blaze
#

espiecally cuz the player can fight back

noble sky
solid blaze
tardy junco
solid blaze
tardy junco
noble sky
#

I have an idea but not 100% how it should work out! Attach a isTrigger sphere collider to the player. Attach a script to the NPC the get the calculated path points, then itirate thru the points and check if it intersect with the player collider. You can use, Physics.SphereCast for that.

solid blaze
sacred loom
#

Hii I have an issue that I’ve been trying to resolve but I can’t figure it out. I completed the roll a ball tutorial and now im adding another plane and a ramp leading up to it. My ball goes up the plane fine but when my ai chases me it stops at the very top of the ramp and doesn’t come into the plane (I baked everything too) pls help

robust linden
sacred loom
#

Ahhh I figured it out thank u tho!!

#

Now I have another issue regarding the countdown timer tho 😭

marsh egret
#

I am trying to train Arc Raiders flying enemy like AIs

#

I would like to discuss approaches on training this kinds of AI

#

has anyone attempted this kind of training?

noble fog
#

No need to cross-post.

round salmon
#

is it possible to change a navmesh area at runtime without rebuilding the entire navmesh ?

#

i cant see a way to do it from the components, other than using obstacle but i just want to restrict an area to a specific agent

marsh egret
#

I am trying to make flying AI that navigates through places and search for "score point". I am struggling as to how to design its sensors and storing what it detects, has anyone tried this kind of AI?

tardy junco
noble sky
serene moat
#

Hey I'm checking the AI package, and honestly it seems a bit basic when compared to stuff like A* Project, which receives more updates and has way more features, is that like, kinda the point? I'm thinking of basic seek and destroy AI, but unity's package lacks, for example, node graphs, which I think are the simpler form of navigation and excellent for aerial / flying agents and A* Project does have it.
Also A* Project has burst and other features that makes it do what Unity does but better either way

#

I think that what I want to ask is whenever would anybody truly recommend purchasing the A* Project or not.

#

Given my case where I can probably reimplement node graphs myself, but not as good.

tardy junco
# serene moat Hey I'm checking the AI package, and honestly it seems a bit basic when compared...

Unity navmesh implementation is not exposed, so you can't possibly see all of it. They're using A* (the algorithm, not the package) under the hood, so it's pretty similar. They have node graph as well(you can't do A* without a node graph), though it's based on the baked navmesh, not the whole 3d space, which is supposed to make it faster.
Needless to say, engine internal code is likely burst compiled, and uses multitgreading.
When you compare unity navmesh with the A* in terms of performance you're probably comparing apples to apples(for example unity adds a lot of extra, like dynamic obstacle avoidance, that adds a lot of overhead).
Yes, the built-in navigation solution has limitations(not suitable for 3d space/flying navigation, like any other engine feature and you can't customize it much, since most of it is close sourced. Which is exactly why third party solutions appeared. However for many use cases it's still pretty good.
They're not updating it because, there's not much room for improvement within the package design philosophy. If there's gonna be a new solution, it's probably gonna be a separate package.

tardy junco
tardy junco
serene moat
#

The gist of my thoughts are "I have the money and might as well just buy it instead of reinventing the wheel" to put it down. About Burst, I really don't know since from what I recall I didn't see anything regarding that on the changelog.

tardy junco
#

There wouldn't be anything on the changelog, since the pathfinding part is engine internal implementation. Besides, burst is just a C# -> SIMD compatible C++ source generator. There's no point in it for the C++ side code. It's very much possible that the pathfinding implementation was using simd instructions from the very start.

buoyant lynx
#

So at one frame I call agent.set destination on a target at unavailable area, I am seeing that NavMeshAgent.pathStatus is PathComplete (which is what I expect because an agent is already on closes navmesh edge)
Yet agent.pathPending returns true
Does that mean that path is still calculated? And PathComplete is about an old path?

#

The overall situation is that an agent goes to the corner/edge of navmesh, and waits till player move away from navmesh further
And then at the moment player go too far I want to differentiate at that frame if it's possible (yeah no much practical need but I am curious if it can be done) if agent need to move, or still at a closest spot

#

I assume if best case scenario set destination may generate path instantly, right? if no and it will always have one frame delay tell me

tardy junco
tardy junco
buoyant lynx
tardy junco
#

It makes sense to use when you need to do something with the path and not necessarily move along it.

#

For example, in my game I have an action queue system, where the character can execute a sequence of actions, like interacting with a prop. If the prop is out of reach, I calculate the path and check if it's reachable and whether there are doors along the path. If there are and the character can't open them, the whole action sequence is canceled.

buoyant lynx
#

@tardy junco what about regular use? Otherwise NPCs would essentially alaways go into idle state for one frame or a bit more after getting need to chase the player condition

#

or I ll have to incorporate idling piece into such states
if there is a cheap way to avoid that delay why not

#

By the way is there an API or something to see how ugh.... loaded is that agent pathfinding queue thingie.... I want to see when it starting to get too many requests and halting too bad
Yeah I already found out in settings I can increase it's efficiency by paying the price of performance, and I found out that I can setup cooldown timers according to checks of squared distance to target to optimize it

tardy junco
#

If not, then I guess it would make sense to use it in such scenario as well.

tardy junco
buoyant lynx
#

I think... it would make more sense to call Stop instead, right?

#

I think not, not much difference at usual FPS setting

#

I feel like I am trying too hard but really want to do the most robust and reasonable mob AI script I can make

rigid imp
#

anyone have any idea how you'd handle a situation where you have an obstacle that carves the navmesh but also has a link to jump over it, yet it can also be a destination for an agent? I want it to handle both of these cases, but with my current setup, when the obstacle is the destination, it first triggers the link, jumps over, then goes back towards the obstacle.

rough nimbus
#

im starting to realize that pathfinding, both 3d and 2d, is the main thing that causes me to get burnt out on my projects. I should really look into a easier method of implementing pathfinding

vital oasis
#

Is this a known bug?
I had stack overflow exception thrown in some logic that was using navmesh, and this caused navmesh to allocate 67 bytes (no im not joking) which was navmesh's build output path for some reason
and unity kept complaining about it unti i restarted
i think i can recreate that in a fresh project
it happened on 6.3f0 for me

tardy junco
#

67 bytes is not a lot, so it wouldn't be surprising if it allocates it in some scenarios.
Other than that, you should probably share the editor/player log after the crash. If you can reproduce it.

violet wyvern
#

Is there a way to force a new velocity onto NavMeshAgent in a way so that its movement is not constrained? I use the NavMeshAgent for my player character and it is detecting jump points in real time, and i don't really know how to implement the jump itself because changing agent's velocity.y still constrains its movement to the navmesh. Is it a good idea to just switch to character controller for the jump and then switch right back to navmeshagent as player makes the jump? Won't there be any jitter because of component changes?

vital oasis
tardy junco
tardy junco
violet wyvern
tardy junco
violet wyvern
tardy junco
#

Just to make it clear, not navmesh "checks", but calculate the path and follow along it.

buoyant lynx
#

I had no isses with agents chasing the player since player is not an agent, however, now I see that when I made agents to treat each other as targets to chase, they are slowing down while enclosing
this is like, bad, is there a way to fix that without making my own "agent" component from almost scratch?
and without setting avoidance to none

wispy vale
#

Im having issues with Behavior where if I connect some nodes wrong it floods the console with error and capsizes my performance for the rest of the session

#

is there a way to refresh this easily without restarting the editor

#

Cause I removed the branching connection but its generally still being a problem when I move the node

wispy vale
#

Like im trying to connect the run in parralel to the attack node but its telling me that attack already has a connection somehow

wispy vale
#

This is the full tree btw

burnt sky
#

Hey guys, is there any way to make NavMeshAgent ignore obstacles at runtime?

burnt sky
#

I want to make this ship pass obstacle

violet wyvern
harsh storm
#

heya all, was wondering if unity's navmesh would be more or less optomized than an A* pathfinder for a game where every enemy will be following one path(i will be running the pathfinding once and then creating a spline for the enemies to follow via setting location). the pathfinding will need to be ran only when the player is attempting to place a building ensuring that they never completely block all pathways to the enemy target

#

ah sorry, just realised i didnt mention, but probably should in case it affects the answer, the game will be grid based and all terrain will be flat, though certain enemies will be able to "fly" above towers(they will have their paths calculated ignoring towers but otherwise path along the ground as normal, thier meshes will just be in the air to give the impression of flight)

tardy junco
harsh storm
#

cause i need to test the pathing every time to make sure the end point isnt blocked

tardy junco
harsh storm
#

in my unreal engine prototype i used navmesh but unreal isnt exactly mobile optomised so i gotta leave my comfort zone again 😅

harsh storm
tardy junco
#

That doesn't answer my question. How many times per frame?

#

Anyways, I recommend trying the simplest solution and stress testing with profiling.

#

Then deciding if the processing time is satisfactory for you or not.

harsh storm
tardy junco
#

Then performance shouldn't be an issue IMHO, but again, test and profile.

harsh storm
tardy junco
#

For me 1ms per frame might be fine, but for you unacceptable, so it's kinda hard to give any advices here.

tardy junco
harsh storm
#

is either better for that?

#

in unreal i had trouble for months which was fixed with a 0.05 second delay because the pathing updating was taking longer than a frame and i didnt catch on

tardy junco
#

That's extremely hard to answer. You'll need to test and compare. My estimations is that they're roughly the same, though navmesh could be slightly better on longer paths, as it operates on polygons rather than a constant size grid.

harsh storm
tardy junco
tardy junco
harsh storm
tardy junco
#

Can you rephrase your question? What exactly are you trying to achieve? How are visual studio settings related to the topic?

harsh storm
#

ill admit im defintely more used to things like shooting and player controls in unity than AI, think last AI i made was in uni which was just simply move towards player at all times using navmesh

harsh storm
#

this means that i need to modify the nav mesh every time the player updates a possible tower placement(which i call a hologram)

#

whenever the hologram moves, i need to recalculate the pathing in order to show a spline to the player which is where the enemies would move if the tower was placed in the location they choose

tardy junco
#

OK, so we're talking about modifying the navmesh rather than finding a path?

harsh storm
#

either or, i used navmesh for this example as thats what i used for my unreal demo

#

i need whatevers gonna be best for mobile

#

or preferably for a potato

#

my entire reason for this project is to be better at optomizing

tardy junco
harsh storm
tardy junco
#

This is impossible to answer without testing.

#

In either case, the difference is probably not very big.

#

I don't think this is gonna be a performance bottleneck unless you do it hundreds of times per frame.

harsh storm
#

ok, lets simplify it to somthing you mentioned earlier, being able to switch it if its too bad

#

can both of these techniques be converted to splines?

#

so long as i have a spline i can implement the rest of my code i believe

tardy junco
harsh storm
harsh storm
#

cant belive i never thought of that in the UE prototype 😅

#

then again i would still need a spline to visually show the player the path would i not?

tardy junco
#

Not really. You'd use a line renderer in unity. Not sure about unreal, but it probably has something similar.

#

A spline is something you'd use for curves and stuff.

harsh storm
#

this is an image from the old ipod touch game im loosely baing off of

harsh storm
tardy junco
#

If it's grid based, A* might make more sense logically. But it's not like you can't implement it with navmesh. Though you might struggle with it generating a path going through the center of the cells/tiles. Navmesh would prioritize the closest path in the mesh, that means it would go very close to corners and stuff.

#

And by the way, you don't have to use the A* package. You could implement your own. It's not that complicated. Unless you need all the extra features Tha package provides.

harsh storm
patent fog
#

Hello guys, I'm new to Unity and I'm currently working on a 2d boss rush project game and I wanted to know if yall have some advice to use well ai for boss ?

harsh storm
#

i dont mind the aliens doing either though, cause it would somewhat make sense since theyre still aliens in my game for them to take the shortest path, im not against them taking some diagonals if thats the shortest path

tardy junco
harsh storm
#

ofc if i was using A* id code it so that if they were doing a diagonal with the gridbased and nothing was stopping them they could cut across diagonally anyways

tardy junco
patent fog
tardy junco
harsh storm
#

so just before i leave you alone and let you finally get back to your life XD, id like to just ask one last question: how can i get a line of code to stop and wait for the navmesh to be fully built, as in my unreal prototype it would say that the path was valid, despite the tower blocking the path as the pathing had not rebuilt itself by the time the build check was being ran?

tardy junco
harsh storm
#

...yeah forgot i was in discord and needed shift enter XD

#

ok, so if i were to run, in a bit of rushed code here:
NavMeshVar.BuildNavmesh();
PathVar = NavMeshVar.CalculatePath(transform.position, target.position, NavMeshVar.AllAreas, path);
and then checked that that path was valid, it should return true only when its not blocked

tardy junco
harsh storm
#

ahh, looking at this update may be faster?

tardy junco
#

They are baked. But obstacle components with carving allow modifying the baked data in real time.

harsh storm
tardy junco
tardy junco
harsh storm
tardy junco
harsh storm
#

ill have another looksee, worst comes to worst ig i can always retreat back into the little unreal cave i crawled from XD

#

was probably a bit ambitious to try returning to unity with an idea id never done before when previously it was only stuff id had a pretty good grasp on already(other than my light sensor code, still fairly proud of that one)

tardy junco
#

If you want to avoid black boxes(relying on Unity close sourced implementation), you should implement your own A* pathfinding so that you're in full control of it.
I don't think the pathfinding is gonna be a bottleneck either way. Though I guess it depends on the scope. Anyways, if it's your own implementation you can tailor it to your specific scenario to improve performance.

tardy junco
harsh storm
tardy junco
#

Teamwork is different. You need to communicate and make sure everyone's on the same page.

harsh storm
#

very true

grave hemlock
#

Is it possible to have dynamic area modifider volume? I am trying to create a realistic enemy and NavMesh Obstacle for such stuff isn't fitting, since it only carves out a chunk of the NavMesh. For my case I would like to be able to use moving objects as obstacles that agent will try to avoid, but if there is no other path, it will try to push it's way through the object, and this perfectly fits into a concept of area modifier with more cost than normal area, but I can't really find a way to make it dynamic, so are there other ways to do such stuff?

violet wyvern
spark ice
#

I dont remember how i nav mashed the walls can somone help me please

fleet badge
violet wyvern
spark ice
#

Thx for the help

spark ice
#

for some reason the mash is only on one side off the wall

crimson oxide
old grove
#

Hi there, I have done unity 2d for about 6months + I want to dabble into ml agents but I donno where to start, or if I'll fall into tutorial hell and not learn anything or if things are outdated. Any suggestions

tardy junco
# old grove Hi there, I have done unity 2d for about 6months + I want to dabble into ml agen...

First it would help if you start in the correct channel. This one is for AI navigation specifically.
#1202574086115557446 is for everything else, including ml agents.

As for your question, start with tutorials, but don't just copy them, research everything you don't understand. This applies to any tutorials, not just ml. And you should have understood it by now.
Rwgaeding "outdated", tutorials might be slightly outdated, especially around the environment setup, but that's where the part about "research everything" comes into play.

old grove
tardy junco
visual meteor
#

!code

visual geodeBOT
queen wraith
#

hi, I just saw the navigation static is deprecated, what's the alternative now to exclude a certain GameObject from a nav surface?

tardy junco
#

navmesh surface component

violet wyvern
#

Hi, I'm making a navmesh generator from scratch, or at least trying to :P for now i have a simple voxel grid generator - i use boxchecks to detect voxels, raycasts to check their slope (angle from the normal to vector3.up) and capsulechecks to check if there's enough space around each voxel, and job system for optimization. result on screenshot - blue boxes visualize walkable voxels. but i have a bit of trouble understanding the next step. as we have this mess full of voxels, we should simplify it, right? i have an idea that is visualized on the second image - from this voxel mess we only take the corners (which basically means we skip voxels that have more than 2 neighbors), and then triangulate it? but i heard of something called spans - which stores data about each column. but i don't see how that would help and why my solution (potentially) wouldn't work. can someone please tell me if my way of thinking is correct or how i could fix it? :P

#

well, did a few tests and looks like my solution wouldn't work for non-convex shapes :(

violet wyvern
#

hmm, maybe i could check diagonals too. this way i would exclude voxels that don't have a specific amount of neighbors. but i still aim for a 3d navmesh, so may someone correct me :P

turbid rampart
#

how familiar are you with graph theory?

#

it looks like your trying to find an Euler optimisation so getting insight into that may help you 🙂

violet wyvern
turbid rampart
#

bridges of konisburg 🙂

violet wyvern
#

This channel is purely for AI Navigation (NavMeshes etc.), not ML Agents. Best ask in #1202574086115557446

slim tree
#

im new in this of making games on unity and i wanted to make npcs for vehicles, the thing is i already have a controller for the car, so how do i use navmesh agent with my vehicle controller, the navmesh agent calculates the route to the target while the npc script sends input to the vehicle controller

#

im not sure if i explain myself very well, but i just want to use the path finding stuff from the nav mesh agent and put it on my npc

molten sequoia
leaden drum
#

Hey - very much a beginner here. Currently I am attempting to move over my AI enemy to another location, yet it is not moving correctly (or moving at all. Right now it moves based off a waypoint system (basically it checks if it is at a location then continues), but it is not moving like the others are. Im expecting I am missing something regarding the Nav Ai, but cannot figure out what. I have cleared and created the nav ai surface again, but don't know if this is causing this.
Here is the script that the nav agents follow for the waypoints: https://paste.ofcode.org/388TeSpjkpicVfjuBqHDhNs
Attached is a video of the problem. Please excuse quality.
Can someone see an issue or have an idea that I may need to do to properly reset the Nav Ai surface correctly? Please let me know. Thank you! (Please @ me if you respond, thank you).

leaden drum
marsh lintel
#

Hi, I'm trying to improve my navigation system in my procedural huge world (with chunks). I made a working script that creates the navmesh for the whole loaded world, but with new features I need smaller voxels, and many more navmesh updates: now obstacles can move -they are of course limited to X updates per second, I'm not calling the carving every update, but with a voxel size of 0.1 (from 0.25) it freezes for about 0.2/0.3 seconds every call which is really noticeable. You didn't notice it when it was 0.25.

So, I'm trying to do a local update (e.g. update the navmesh only in the local 50x50 space), but it's cleaning hte navmesh and creating a new one 50x50. Is there a way to do a "local" update of the objects?

#
    public void UpdateNavMesh()
    {
        if (mergedSourcesQueue.TryDequeue(out MergedResult result))
        {
            NavMeshBuildSettings settings = navMeshSurface.GetBuildSettings();

            Bounds finalBounds = result.customBounds ?? new Bounds(target.position, navMeshSize);

            AsyncOperation carve = NavMeshBuilder.UpdateNavMeshDataAsync(navMeshData, settings, result.sources, finalBounds);
            carve.priority = int.MaxValue;

            finishedMerging = false;
            isBuildingNavMesh = false;

            if (!carvedFirstTime)
                StartCoroutine(WaitForCarveToFinish(carve));
        }
    }

This is the function that updates the navmeshdataasync. As you can see it either use the customBounds (always 50x50x50), or the default one which is 2500x2500x2500 (the whole loaded world).
I'm using NavMeshComponents

#

Also, I have many thousands objects loaded. Works really well, up until I need more precision

soft quail
#

How do you guys feel about ai replacing coders/programmers anytime soon? Im studying game development right now but im a bit scared of my future as a future game dev...

torn pelican
#

some jobs are getting replaced because upper management buys into the hype but ai is not in a place to replace jobs anytime soon

molten sequoia
#

!collab @sturdy lodge

visual geodeBOT
hollow marlin
#

how do you keep your scenes from looking like a giant mess of invisible walls and navmesh modifier volumes?

#

or should i embrace the chaos?

tardy junco
tiny comet
#

Hi is there an issue with navmeshsurface gizmos in unity 6 or am I doing something wrong? The navmeshsurface doesn't seem to have that blue colored mesh over any of my level's ground planes.

crystal nacelle
#

it looks like your gizmos are turned off

tiny comet
#

or is there another setting?

#

Oh ok i had to click on that main gizmo icon to activate it...

crystal nacelle
#

this

#

it should be blue 🙂

tiny comet
royal swift
#

Hello, I have an issue reguarding the navMeshAgent, it is kind of diffuclt to describe the problem here, if anyone is open to vc with me to help, please do

royal swift
spiral nacelle
#

Hi everyone, I am implementing a cooperative multi-agent Escape Room environment using MA-POCA
The scenario:

  • I have a group of 4 agents.,
  • The episode finishes only when ALL agents have escaped the room.,
  • When the last agent escapes, a Group Reward (+100) is assigned to the whole team

How should I handle the agents that have already escaped while waiting for the rest of the team to finish, to ensure MA-POCA correctly assigns the credit? I've read that SetActive(false) stops the agent's logic entirely, which might prevent from correctly registering them when the final group reward is distributed at the end of the episode, am I wrong?

torn pelican
stable bronze
#

Hello, I am currently having a really strange issue. I cannot seem to rebake the navmesh in the my scene and have it register any terrain. Even a new terrain I add is completely ignored when I bake. I tested this in a new blank scene and it works, but it refuses to register any terrains in my game scene. I also tried duplicating the scene to no avail. I have no idea why this is happening. Using Unity 2022 if that helps

stable bronze
#

I solved the issue. I disabled all the other gameobjects besides the terrain and navmesh, baked just the terrain first, and then re-enabled everything and baked again

tribal parrot
#

Hello everyone!

I have a question: what the heck is going on with my boss???
I know it because of the settings of my NavMeshAgent

Acceleration - 100
Speed - 100
Angular Speed - 360

Is there a solution to NOT use a Move function instead of calling SetDestination as in an example in video here?

minor prairie
#

How could I stop the abrupt pause when the enemy is under the player? Every enemy stops no matter what when the player jumps, the enemy (scrapwheel) keeps on rolling if it misses the player, but stop abruptly when the player jumps in place.

The enemy is supposed to be a fast-moving cogwheel with rough turning but big damage in groups.

#

my stopping distance is 0 and auto-braking is false

copper shadow
#

Hey. this is like my second ever unity project. but i thought it would be a fun idea to implement a simple enemy ai. If you've ever heard of mindustry, im trying to recreate a pretty simple version of that. i have a core, and the enemies are supposed to go to the core and destroy it. I cannot for the life of me, get the navmesh to actually show up when i generate it! I've spent like the past 10 hours on this POLEASE THIS IS A CRY FOR HELP PLEEEEEEEEEEE3EEASE

#

WAIT OMG SOMETHING IS HAPPENING IDK WHAT I DID BUT I DID SOMETHING AND I THINK THATS THE THING AHGAHAGHAGHGAHAGAGHAGHGahjgagh im gona tweak

wide yew
#

im working on a car chase game with some friends and im in charge of making the cop ai for the game. ive tried using the navmesh/nave mesh agent to make them fallow the player and that works.. kinda... it doesnt allow me to apply our custom car physics the the cars. does anyone have an rescources or anything i can use the find an alternitave ?

violet wyvern
burnt karma
#

I recently published a post about an alternative avoidance solution to the RVO approach used in Unity. Some of you might find it interesting. I’ve also successfully integrated it with Unity’s NavMesh for global navigation.
https://lukaschod.github.io/project-dawn-website/blog/sonar-avoidance/

Project Dawn

Vision-inspired local avoidance algorithm for RTS agents that projects nearby obstacles into angular space and selects collision-free steering directions in real time. By reducing avoidance to a 1D angular domain, it achieves fluid group movement while preserving precise and responsive unit control.

spiral pulsar
#

Is there a way to check if a NavMeshLink is working? In our project we swap NavMeshes as we open up more parts of the game world (the meshes are really small). After swapping I used to disable/reenable the links and it would work. With our biggest level this approach does no longer work for some reason (it works sometimes, but not all the time). How can I check if a link is valid and working?

worthy bay
#

is there a way to generate less "tight" paths around corners
sometimes my enemies get caught on the bend in the stairs and get stuck

what it does vs. what I want

#

for now I'm just putting NavMeshObstacles in problem areas like this but I really hope this engine isn't being defeated by stairs

tardy junco
worthy bay
worthy bay
#

lovely

twilit saddle
#

Is it possible to bake navmesh surfaces on prefabs?

#

Basic cube in a scene vs as a prefab after baking. Only the one in the scene gets a walkable area.

torn pelican
#

i could be wrong but i dont think the system is designed to juggle multiple surfaces in that way

#

you'd wanna bake at runtime after your dynamic stuff is in scene + your prefabs can use stuff like navmeshmodifiers and that one other component to manipulate how it's considered if neccasary

thick hamlet
#

hi rn im trying to make an addon for a game that adds walkable npcs,
but i get a warning saying my agents aren't close enough to the terrain and i get another error for getting the remaining distance,
so the agent just doesn't work at all,
i attached my script and screenshots if anyone can help,
thanks

pastel sparrow
#

is this here the only way to download unity ai?

#

it downloads, but never finishes