#🤖┃ai-navigation

1 messages · Page 2 of 1

rugged palm
#

and rigidbodies

mystic stag
#

yeah they have capsule colliders

#

no rigidbodies but it's more about the navmesh and not the agents

rugged palm
#

yh

mystic stag
#

since I want them to path find around the trees

rugged palm
mystic stag
#

what do you mean custom?

rugged palm
#

I mean like made on your own or off the asset store or something. Maybe I'm wrong about it being default because I haven't used navmesh since last year

rugged palm
mystic stag
#

yeah it's from the asset store but even if I make a really crude tree in unity and use that it still doesn't work

#

terrain painter

lunar plover
#

im using astar for ai its working pretty good apart from when i made stairs for a quick test he can climb all of them apart from one because its too tall so he decided to just go through the stair/clip through it and i dont want him to do that i just want him to stop walking if he runs into it

dusty harbor
#

How do I use NavMesh but for 2d?

native dome
#

Using the new Navigation system, anyone know could be causing this issue? The terrain are cubes, and the character in the scene starts atop of it. But when the game is ran they're trasfered to the side of the of the building.

dark sphinx
#

check the baked navmesh and see if the top of the building is included

#

also:
what is the suggested navmeshagent.setdestination() calls per frame? I have ~50 and am wondering if this has a significant impact on frame time

worthy mason
#

A I

lunar plover
#

first image is on the enemy and the 2nd image is just a empty gameobject with pathfinder

meager venture
#

Can we get a pastebin of AIDestinationSetter?

lunar plover
#

sure

lunar plover
meager venture
lunar plover
#

yes but in pathfinder

meager venture
#

have you tried playing with that setting to adjust it to what your preferred max height would be for the AI to "climb"

lunar plover
#

yeah i tried 3 worked fine but i dont want him to be able to climb stairs that high so i set it to 2 but its too low

#

he doesnt even jump

meager venture
#

Ah alright, well I have no exposure to that specific plugin so I'm not too sure other than that. I know most of these script have a height for the raycast. Or there might be some way to edit the navmesh to prevent it. I don't have a ton of exposure to 3D sadly.

lunar plover
#

everything is so much more annoying in 3d

#

its fine tho

quiet fossil
#

Make sure u got the right package installed

#

should be in the package manager

#

probably named ai nav or something like that

#

nice 👍

rain steppe
#

I've got a list of vectors that I want the agent to travel to in order, how would I go about doing that?

rain steppe
#

also can someone help me find what's wrong with my a star algorithm, it seems to ignore the heuristic and just take the nearest node

pulsar jewel
#

I tried to add knockback to an enemy using rb.addforce and it didn't seem to do anything. Is there something I have to do with the A* tracking to be able to have knockback with it?

#

This is for a 2d game as well

jovial creek
#

Probably need to disable pathfind movent while knockback is active

pulsar jewel
#

Is there a built in way to toggle that in the A* classes or do you mean just straight up disabling the component on the enemy. @jovial creek

#

That does make sense though, I was assuming the pathfinding was just ignoring it

jovial creek
#

Im ot at my computer so i cant test, but if i remember you just dont call agent move to target

#

Youl have to test it out and see what works

tardy forge
#

Hi Iam making a 2D Top Down shooter in Unity.
I have an enemy, that follows the player in the shortest path as possible an avoid obstacles.
Im using the navmesh agent components and want the enemy to hide / cover behind obstacles, when he is at a certain low level of health.
Does someone know how I can implement a "hide" or "cover" function?

quartz gyro
#

For some unknown reason my NPC ignores the height of the navmesh attached to the building and think the height is the same as the navmesh attached to the terrain even though there is no navmesh attached to the terrain at the position of the NPC. Can someone tell me how I fix this?

plain pond
#

How do folks go about baking terrain features like tall grass (laid down with Edit Trees) so they can be walkable by the navmeshagent?

lone tundra
ocean marlin
#

Hello there! I am making a game which randomly generates a maze every time the main scene is launched. the walls of the maze are randomly generated which are the main obstacles. So, I tried baking the floor which is a Static mesh and adding the NavMesh Obstacle to the wall prefabs. Well, it doesn't work since the AI character still goes and hits a wall and gets stuck there. Is there any other way to do this using navmesh or do I need to code a whole wall detection thing for the AI?

alpine glacier
#

The capsule is not static, why does it bake there?

vivid marten
#

This is how normally my navmesh in my game looks.

#

Sometimes though, when l break windows in my game, the navmesh starts to break in some parts and it looks like this

#

not sure why does this happen

#

These are my settings for the navmesh surface

#

l don't think it has to do with scripting, but l will send my windows' script just in case

#

And just an info, every broken window gets this layer, which doesn't get included in the navmesh in the next update

ocean marlin
#

Why don't I have the NavMeshVolume component in my unity ;-; Doesn't appear when I search for it

ocean marlin
#

Ohhh thank you so much

ocean marlin
#

PensiveFast I had to update from 2020 to 2021 version of unity to get this option so hence why i took some time LeGasp

rustic obsidian
#

This may or may not be because Unity is having some network issues rn

ocean marlin
#

I see, what if it isn't

rustic obsidian
#

No idea. Check the console for errors

ocean marlin
rustic obsidian
#

It's probably just the network issue. You could try adding it directly to your manifest.json file if you know what you're doing

ocean marlin
#

I don't 😭 I will try thoughh, thanks for the help :D

jolly sluice
#

i previously closed the floating navigation thingy that normally appears on the bottom right of the editor window - how do i get this back?

gaunt wadi
#

I'm having some problems with my custom pathfinding algorithim, could anyone help me figure it out?

#

Here it is, I don't know why it isn't work, but it isn't...

Also, for reference, NPC_direction is the gameObject's localEulerAngles.y, and NPC_AISpeed is how the AI affects it's movement, y for forward/backward and x for rotation left and right (in 45*)

alpine glacier
#

can someone please give me a walk through of how to setup ai in unity 2021.3.15f1

#

ive tried a tutorial but it didnt work

#

hello pls?

ocean marlin
#

IDK where to ask this but Any idea on how I can Instantiate GameObjects on a NavMesh Area. Like, i want to instantiate stuff only on Walkable area, how do I do this through code?

sharp gulch
vivid marten
#

no it's more like a remake

alpine glacier
#

I've baked the same nav mesh 20 times in a row but it's not changing shape even after I've added a lot of different buildings and structures, made them static, etc. I can't figure out why the bake isn't working

#

I fixed part of it, but the outline of a water well I deleted is still there for some reason

novel lance
#

Hello. How can I remove these bevels and make the movement right angles?

marsh verge
#

is pathStatus meant to be Complete before all the paths corners have been calculated? or is that a bug?

marsh verge
exotic raven
#

hope my code works

rustic obsidian
alpine glacier
molten trellis
#

I have a zombie ai from the HFPS kit pack in my game and he will not detect the player or walk around. I have a baked navmesh any ideas?

rustic obsidian
#

I mean exactly what I said

exotic raven
#

whats an ide

rustic obsidian
exotic raven
#

(im new to game development as you can see)

#

how do i fix it

rustic obsidian
#

Run through the configuration instructions for your IDE, under IDE Configuration in #854851968446365696

devout wren
#

Any thoughts? Better or more simple ways to have (a lot) of agents chasing or following targets? 🤔 tips & feedback welcome 🙏

#

Close to target is true if distance from agent to target is <= stopping distance

naive sphinx
#

Ive then made an adapted version for a shooting enemy that does the same, but if its too close it will move in the negative speed causing it to back away from the player

#

Its fun working with ai making enemys do different things

devout wren
#

Indeed! I have a really nice, modular state machine for my npc brain

#

Lots of options! For diff behaviors

naive sphinx
#

And then ive made it so when the enemy is close to you it will hit me every 2 seconds

naive sphinx
devout wren
#

Yep! Ive gome basic attack stuff working when in range. Some animations that do things haha. Progress!

#

Thank you! The backing up is cool. I wonder how to do that with nav mesh agents 🤔

naive sphinx
naive sphinx
devout wren
#

Just progress. Ive made a few state machines before. 😉

sick shoal
#

I have a question about the AI navigation package - are NavMeshObstacle components dynamic? I have a pretty basic problem - a door that can be locked and unlocked, which should disable and enable the ability for AIs to go through. Can I achieve this by just toggling the NavMeshObstacle's carve bool, or there's something more to this?

devout wren
#

just leave carve on, and move the door, the nav mesh will update . there are a few good youtube vids on this one

alpine glacier
devout wren
#

bro i have a major love of whiteboards for dev work

#

flow chart apps and sites dont cut it

alpine glacier
#

Yeah

#

That’s a lot or arrows lol

devout wren
#

indeed

#

best to use whiteboard vs just jumping into code on my messy thoughts

alpine glacier
#

Yeah same for me

devout wren
#

side note, got my ai npcs moving better... need to update my whiteboard to match my in code fixes, then examine to see if i can optimize, (where data is stored, etc)

#

this kinda came in clutch

alpine glacier
#

I'm trying to get an enemy I've designed to move and do stuff. I created a navmesh that outlines a small arch and the four walls and floor as its components.

However, all the enemy can do is turn to face the player. It doesn't move, and it also doesn't take pitch into account.

Please advise?

tardy steppe
#

how could i make an npc move well on a non-flat terrain?

Type that does not fluctuate or that does not bury itself if there is a slightly wavy ground

swift marlin
alpine glacier
# alpine glacier Here's my code:

UPDATE...

I had to create an empty parent for this thing to hold its true position, as the animation was somehow causing it to stay in the same position all the time.

alpine glacier
#

I'm trying to figure out how to get it working as well.

alpine glacier
#

I just need this thing to fly and trigger animations... 😦

alpine glacier
#

I have my drone starting off hovering in the air, but when I preview the game, it's halfway buried in the floor for some reason.

#

There ought to be a way for it to fly freely, no?

#

I'm utilizing SetDestination for my navmesh agent, btw... as you can see in the code.

devout wren
#

Has anyone added custom data to OffMeshLinkData, like a float or bool field I could fill out in inspector for off mesh links and nav mesh links?!?

devout wren
#

when agents are on "OffMeshLinks" i can access the area type, and other info of off mesh link. I cant seem to get that info when agents are on NavMeshLinks... it knows its on an offmeshlink, but the OffMeshLinkData.offMeshLink is null

devout wren
#

think i found a thing

#

NavMeshLink currentLink = (NavMeshLink)agent.navMeshOwner); !?!

devout wren
#

got it. .. getting anims and movement for off mesh links is not easy lol.

#

and stopping agents while on offMeshLinks is also quite a time

solemn hull
daring arch
small otter
#

How can I stop the navigation mesh from generating inside terrain tree objects?

#

I've already tried placing another mesh in the middle to block it but that hasnt worked

#

or any other solution to stop ai from spawning inside them since I'm randomly choosing anywhere with a navigation mesh on it

alpine glacier
#

navmesh obstacle component on carve i believe

cloud meadow
#

I keep getting this error when I try to make a nav mesh, I've baked the ground and given the sprite the navmeshagent component aswell as a movement script. (2d) What else am I doing wrong?

#

ok I found navmeshplus but its missing a couple of scripts

kind hound
#

can navmeshagent work with rigidbody?

quiet fossil
kind hound
#

and how is it different from dynamic?

#

and why cant i use dynamic?

kind hound
#

How can I make my nav agents not just go along the edges of navmeshes? I'd rather they walk in the middle of the road than the edge

severe gorge
#

uhm why does this baked pathfinding data from my old scene carry over to this new one?

#

the "clear" button doesnt fix it

severe gorge
#

ok wow

#

this was on Unity 2021.2 LTS, the newest version!

#

but updating to tech stream fixed it

pure tide
#

im super new to gamedev and have made a good amount of progress with stuff, ai is tripping me up a lot though and I'm running into some decision paralysis on what to look at/read up first. Behaviour trees theres a ton of free options but i'm unsure on the functionality/quality of all of them and dont know enough to be able to really edit them, and utility ais math seems hard. I'll probably just stick to states atm until that gets to a breaking point but is it worth looking at paid options for AI at this stage?

jaunty raft
pure tide
#

Was having a play with the kiwi coder behaviour tree, it seemed decent, if anyone's had a look at it is there anything g that stands out as missing?

pure tide
bitter heart
#

is it possible to make navmesh agent navigate by navmesh but walk on the actual collider of ground?

boreal badger
#

cannot figure why my AI keeps floating, I tried fiddling with navmesh settings, nothing seems to be fixing it, tried baking height map too, but that didn't do anything

boreal badger
kind hound
#

how can i make it so my objects dont take the easiest path, and instead have some variation in their paths?

#

it looks unnatural and they just go along the edge of the navmesh

limber nacelle
#

Hey, are there any good gameAI discord servers out there, or is this channel pretty much it?

lethal agate
lethal agate
limber nacelle
#

Does anyone have experience writing a GOAP?

Something that isn't clear to me is how to design the graph. Is each node a theoretical world state, and the edges an action with a cost that gets them from 1 state to another?

limber nacelle
left nymph
lone tundra
grim kindle
#

I don't know if it's appropriate to ask this here but I've been talking to ChatGPT for a few days and it's fun. How can I make something like it that I can run on my PC locally? It doesn't need to be just as good just a similar type of thing.

kind hound
jaunty raft
# grim kindle I don't know if it's appropriate to ask this here but I've been talking to ChatG...

We build a Generatively Pretrained Transformer (GPT), following the paper "Attention is All You Need" and OpenAI's GPT-2 / GPT-3. We talk about connections to ChatGPT, which has taken the world by storm. We watch GitHub Copilot, itself a GPT, help us write a GPT (meta :D!) . I recommend people watch the earlier makemore videos to get comfortable...

▶ Play video
jaunty raft
little nymph
#

Hello everyone! I'm trying to get navmesh agents to chase the player, attack once, and then go hide behind a wall. I've gotten the attacking the player working fine, the issue is making the agents hide behind something. Any tips?

grim kindle
#

@jaunty raft I watched a very simple and right to the point video that's 2 minutes long and shows me exactly how to run a pretrained GPT-2 model on my PC. And that's exactly what I wanted. I'm somewhat interested in learning about it all and the code and theory around it but right now I just want to play around with different models that I can run on my computer. I'm not that interested in actually learning it yet. I only want to run it and see the results on my own hardware.

undone wind
#

Hey I’m trying to create a 2d enemy ai system. Does anyone know any good videos to start with?

terse mural
#

I'm not sure how to visualize this but I have a problem with NavMeshAgent
When starting, the GameObject jumps instantly to the max terrain x,z coordinates then it starts walking to the destination x,z from there
And if there's an obstacle between initial position and max, it gets stuck completely

still pagoda
#

Hello everyone! Is it possible to make an AI that sneaks up on the player? If yes, are there any tutorials on how to do it?

severe crescent
# still pagoda Hello everyone! Is it possible to make an AI that sneaks up on the player? If ye...

great place to start is comp3 interactives tutorial on A.I. field of vision
https://www.youtube.com/watch?v=j1-OyLo77ss&t=710s

Enemies usually have eyes, right? So lets give your enemies some vision! In this video we're going to add a really simple but really effective field of view, field of vision, cone of view, line of sight... Whatever you want to call it, to your enemies!

We're also going to make sure that the enemies can't see you through walls and AS A BONUS! We...

▶ Play video
#

not a direct way of getting your desired result

#

but

#

what you could do from this tutorial is check what the players camera direction is from the A.I.

#

and if having found the player is looking away or atleast the A.I. is out of view, taking the A.I. navmesh agent and doing .SetDestination(player.transform.position);

pure tide
#

the rest will work fine

#

Was just about to post for help on this actually, this was the post
"Looking for help with enemy AI field of vision for a stealth game
Based on a tutorial I've got it setup rn that when a behaviour tree thing is triggered it uses an OverlapSphereNonAlloc to collect nearby targets in a layer ("living") with a certain script. It then casts vector distance cone in front of it and then a raycast to check that the object is in front of it and has no objects blocking it, and then confirms the target as its current target
the issue im running into is for some reason if I have more than one of these enemies with this behaviour one of the enemies will not get a target. Any idea what could cause this? "

severe crescent
#

wish I could help

pure tide
#

all g

severe crescent
#

I mean it's probably something to do with a variable not being set up correctly but beyond that I have no idea

pure tide
#

im also unsure on how i wanna handle actions for guards reacting to enemies/allies or if i should even have the fov checks in the behaviour tree
id like to give guards a chance to comment on their allies if they notice them and potentially do different things (like chat or notice if ones been damaged, or instead of patrolling seperately following that guards patrol path). I dont want them to do any of that over noticing the player though, the player being seen should interrupt everything theyre doing and switch them into combat mode.
i thought about running two checks (one for enemies and allies) but idk

hollow elk
#

does anyone can recommend me a tutorial for a pathfinder that can see changes that the level takes, and make jumps and climb to try to get to the destination?
I have time, so if is a tutorial of multiple parts it's even better.

#

when I say climb, I'm not talking about the character being able to walk in walls, but the player can jump through ledges in walls, and it would be really cool if the enemies could do the same

#

I'm making a horde game so if I can make the enemies make crazy thing s to try to get to the player it will be really cool

kind hound
#

@lone tundra sorry to ping you but could you explain to me what noise to the cost of a node is

lone tundra
#

In what context?

kind hound
kind hound
lone tundra
#

It depends on your pathfinder, but generally you have some fost associated with each node, which is how your agent picks the 'best' node. That's why they follow the edges precisely. If you add some noise to it, they will wander a little.

kind hound
#

ignore all the blue ones but the green lines are the paths it would follow

#

and its going along the edge of the navmesh

#

i'll do more research on noise, thanks

#

also i've notticed that it can only change directions at intersections in the actual mesh object

#

is noise applied to the mesh?

lone tundra
kind hound
hoary silo
#

Hi! I'm using the runtime navmesh generation package for a mobile project I'm using - basically I switch between different instantiated prefabs and they generate navmeshes at start(). I think i'm running into a problem when switching between different prefabs and navmeshes though - the previously generated navmesh isn't being destroyed, so newly spawned nav agents are using outdated navmeshes. Is there a way to clear all generated navmeshes using the runtime navmesh generation package?

left nymph
#

the question is if you have easy access to the handle of the navmesh that was generated

hoary silo
#

I'm using a pretty simple navmesh surface for it - and yeah I couldn't find how to get the navmesh handle from BuildNavMesh() - documentation on the package seems pretty thin

#

For more context - pressing a button deletes the existing level prefab and instantiates a new one - the level manager script then does any required setup for the level, adding gamemanager references and handling activation of objects and such

proper birch
#
        public void GenerateAllNavMeshSurfaces()
        {
            ClearAllNavMeshSurfaces();

            int agentCount = NavMesh.GetSettingsCount();
            
            for (int i = 0; i < agentCount; i++)
            {
                NavMeshBuildSettings setting = GenerateBuildSettingsFromIndex(i);
                Bounds levelBounds = gameObject.CollectColliderBounds(1f);
                List<NavMeshBuildSource> sources = new();
                List<NavMeshBuildMarkup> markups = new();
                NavMeshBuilder.CollectSources(levelBounds, -1, NavMeshCollectGeometry.PhysicsColliders, 0, false, markups, false, sources);

                NavMeshData surfaceData = NavMeshBuilder.BuildNavMeshData(setting, sources, levelBounds, transform.position, transform.rotation);
                surfaces.Add(surfaceData);

                NavMesh.AddNavMeshData(surfaces[i]);
            }
        }
#

I have already added the navmesh data to NavMesh, but it seems like its not enough?

hoary silo
# proper birch Hey, just a quick question, I am generating NavMesh at runtime, but I kept getti...

I managed to replicate this issue by switching and building navmeshes too quickly! Didn't find a solution for it though. Ideally I'd like to find something similar to the Unreal Engine navmesh generation volume - for whatever reason calling BuildNavMesh() is building navigation for everything - not just navmesh surfaces. I'm not sure how to fix this but I'd appreciate any insights possible.

@left nymph I think that using NavMesh.RemoveAllNavMeshData() worked somewhat - but I have to generate and clear the navmesh twice in order to make it work - makes me think that it's something to do with function order.

left nymph
# hoary silo I managed to replicate this issue by switching and building navmeshes too quickl...

sorry I havent encountered that problem yet. I converted all that NavMeshSurface stuff to DOTS so i am not using the official components but basically implemented their functionality myself. What i do to update NavMesh when level geometry changes is that i call
NavMeshBuilder.UpdateNavMeshDataAsync() and pass in the new list of buildsources. I have a single NavmeshData per agent that i always keep around and just update.

#

There is UpdateNavMesh() on NavMeshSurface. you could try that

proper birch
#

Now I encounted a lot of bugs with NavMeshObstacle when its set to carve = true

#

Carved obstacles still counts as true in agent.isOnNavMesh, and it caused the agent to behave strangely if carving happened on top of the agent.

#

It either stops moving completely, or rubber band to the last stuck position when it moves.

#

I expect agents to just displace itself to where it isn't carved, but it seems like it isn't the case.

kind hound
#

for navmeshagents, how do i interrupt a path and overwrite it with a new one?

hushed tide
#

Just assign a new path

#

At the highest level you can just assign a new destination, then it will path to it.

flat granite
#

Hallo! I have a problem: During runtime I manipulate the navMeshData of NavMeshSurface via NavMeshBuilder.UpdateNavMeshDataAsync. Unfortunately this means that the navMeshData asset gets changed on the harddisk too, is there a way to circumvent this?

#

I tried to do surface.navMeshData = Instantiate(surface.navMeshData);, but that leads to UpdateNavMeshDataAsync()not working anymore

flat granite
#

Okay, I think I fixed it.

left nymph
flat granite
#

tbh i might do something wrong. i find the documentation for all this is very lacking

#

This is how I update the nav mesh during runtime:

        IEnumerator UpdateMeshesCR(Bounds localBounds) {
            yield return null;
            var sources = new List<NavMeshBuildSource>();
            var surfaces = FindObjectsOfType<NavMeshSurface>(false);
            foreach (var surf in surfaces) {
                var source = new List<NavMeshBuildSource>();
                NavMeshBuilder.CollectSources(surf.transform, layerMask, NavMeshCollectGeometry.PhysicsColliders, 0, new List<NavMeshBuildMarkup>(), source);
                sources.AddRange(source);
            }
            foreach (var surf in surfaces) {
                var settings = surf.GetBuildSettings();
                settings.preserveTilesOutsideBounds = true;
                var op = NavMeshBuilder.UpdateNavMeshDataAsync(surf.navMeshData, settings, sources, localBounds);
                while (!op.isDone) { yield return null; }
                yield return null;
            }
        }```
alpine glacier
#

Maybe this is the right place to ask

How can I make navmeshagents never instantly decelerate when reaching their destination? Autobrake=false has no effect

jaunty raft
alpine glacier
#

I guess, but they could be facing multiple ways

#

Like what if their velocity vector is 20 degrees to the left of the target, how much do I slow them by so as to not overshoot. And at that point would I really want to use Navmeshagent.

alpine glacier
#

Negative stopping distance would be nice

barren whale
#

Hello, how can i give an npc a decided path to follow in unity 2d?
I need to give an npc a specific path to follow, which includes jumping and falling. I would need it not to follow the player, but to go direct. I was thinking about NAVMESH, but it wont work with 2d. Advice?

jovial creek
#

Nav mesh works in 2d with an extension

#

Surprisingly simple actually

limber nacelle
#

what are the benefits of GOAP over HTN?

#

HTN is faster & more controllable.

barren whale
jovial creek
#

Use navmesh plus

barren whale
#

And i can set that i want that i follows a lot of point?

#

Like a rout based on point 1
point 2
point4
point 3

left nymph
limber nacelle
#

HTN is so verbose -.-

left nymph
#

@limber nacelle im a huge fan of utilityAI. pretty easy to get going. and it kinda does the same planning as GOAP/HTN but implicitly

#

if you set it up in a way that the next step in a plan has higher utility because the previous step got executed you essentially get planned behaviour thats dynamically adjusting to surroundings

limber nacelle
#

once the graph gets big enough it's too many ifs

left nymph
limber nacelle
#

Let's say the actors goal is to craft 5 beds. Possible actions are:

  • CraftBed (-6 plank, +1 bed)
  • CraftPlank (-1 wood, +2 plank)
  • ChopWood(needs axe)

How would you author this with a utilityAI?

#

@left nymph I'm a big fan of utilityAI as well, so any insight helps ^^

left nymph
#

its weird to type it out i guess but here i go:
CraftBedDecision has inputAxis : PlankCount, ProximityToBedCraftingStation
CraftPlankDecision has inputAxis: WoodCount, ProximityToPlankCraftingStation
ChopWoodDecision has inputAxis: AxeCount,ProximityToWoodSource

#

when PlankCount is under 6 your inputAxis for it needs to output a utilityScore of 0. so when its multiplied with proximityToBedCraftingStation it will always have a utility of 0.

#

same with woodcount

#

the proximity inputs should probably be linear. the closer you are to a craftingstation the more utility it has to craft now instead of running into the woods to gather more wood

limber nacelle
#

That's good, but somewhere you need to limit it to 5 beds. And if actor has 5 beds, he doesn't need to make more planks or cut more wood.

#

and the wood count needed depends on the plank count you have, which depends on the beds you've made so far

#

like, the combinatorics start to explode

left nymph
#

combinatorics are what are handled easily by UtilityAI compared to a Behaviour tree or sth.

limber nacelle
#

I'm not sure what are the right curves, but ok. You could agree that it would be a lot simpler to use GOAP tho, right? Just feed it the goal WorldState(beds = 5) and the three actions and it'll spit out a plan.

left nymph
#

@limber nacelle

#

here ive roughly done it for you. took about 5 min to setup with my workflow 🙂

#

since i have no actual inputparameters in my sample that correspond to axe / wood etc the first layer of nodes has no curves defined. would take another minute or so

left nymph
#

sry ill need to answer later. had sth come up i need to deal with. ill probably just dm you if you are alright with that

limber nacelle
#

sure np 🙂

left nymph
#

@limber nacelle

#

just to finish it up in here. thats how it could like with your additional requirements.
not tested obviously so i might have a bug in there. having more planks reduces the desire to craft planks. having 5 beds completely stops everything. having low supply of planks increases desire to gather wood.

limber nacelle
#

cool, i dmed u

viscid topaz
#

Hello Brothers

#

my problem is the nav mesh agent can push me

#

i want him to do nothing just try to walk

#

like i dont want him do avoid me or somthing or push me i want him to stay at his place

alpine glacier
#

Asking again does anyone know a way to outright disable instant stopping behavior on the navmeshagent?

alpine glacier
#

Unfortunately this will make him ghost through you

#

There is essentially no built-in way to make him act as an obstacle, though there's an easy way to script it

left nymph
alpine glacier
#

The problem is my game has knockback

#

so stopping distance can vary

#

I came up with a complex custom solution that looks cool tho

#

wanna see?

left nymph
#

sure

#

why is knockback a problem here?

alpine glacier
#

I mean suppose you're going at full speed and you get knocked right next to your target

#

you'll go 100-0

#

clearly my solution needs some work

left nymph
alpine glacier
#

nah

left nymph
#

or maybe its the collision that stops you

alpine glacier
#

I tested

#

you can have 10 seconds to accelerate

#

and it will just stop once it hits the target

#

instantly

left nymph
#

thats very weird cause i had my agents constantly overshooting

alpine glacier
#

they overshoot if they miss the target

#

so one of my solutions is to force them to miss

#

by like 0.25

#

it works too

left nymph
#

hmm in that case i would probably handle moving the agents myself. setting updatePosition to false and writing my own movementcode moving them towards the steeringtarget

alpine glacier
#

with updatePosition=false it sets the navmeshagent position just not the transform right?

#

so you get desync

#

something to look into tho yeah

left nymph
#

ah i cant remember exactly how it did it back then. but i managed somehow to basically only use the agent for pathfinding and then moving along the path with my movement Code.

#

without desync

alpine glacier
#

getPath probably

#

how do you move smoothly anyway?

#

with a rigidbody?

left nymph
#

i cant remember my exact solution. it was some weird ECS hybrid stuff. my entities drove the agents position while they used the agents pathfinding

alpine glacier
#

I hear it's common

#

well thanks, cya

left nymph
alpine glacier
#

it does if they are disabled

#

I also tested that for knockback

#

the only issue is if they run at the same time, cuz that's nondeterministic, don't know which script will operate first

#

that's what the docs said iirc

left nymph
#

your in the same boat as me. whenever i tried to use the basic navmeshagent it failed in at least one edgecase. at some point i just wrote my own agent.

alpine glacier
#

how?

#

seems complicated

left nymph
#

i didnt need local avoidance so it was not that hard.

alpine glacier
#

ah yeah

#

so you mean you don't need agent-to-agent avoidance?

#

or don't even need agent-to-obstacle-avoidance?

left nymph
#

agent to agent

alpine glacier
#

cuz it still seems hard with agent-to-obstacle avoidance

left nymph
#

no because you can query the navmesh yourself for paths and then just follow them

alpine glacier
#

right

barren whale
barren whale
#

I just analyzed that it loads the points so fast before getting there (see debug) because there it goes to update with the fixedupdate too fast, even before they get there. How do I fix it?

tall void
#

Hey, is there a cool way to avoid that the NavMesh Agents walk in a row behind each other when they walk to the same destination?

noble fog
#

@errant igloo no memes, please

tidal rivet
errant igloo
noble fog
#

Anywhere else

kind hound
#

why is my AI path doing this? the circle is the radius of pathfinding, they seem to lock into each other for some reason

#

its like theres a solid object between them

left nymph
kind hound
pliant galleon
#

why are the paths so thin?

#

and how do i make them bigger

#

like wider

jaunty raft
pliant galleon
#

wont that lead to issues in future tho

frosty cove
# tall void Someone ?😂

Depends on your need, here are some solutions I used for my game :

Set their radius to 0.1f
Changed their priority
Set their destination to a randomized position so they all have different path
Spawned them at a randomized position

tall void
left nymph
final coyote
#

Hey, could someone recommend me a solid guide on how ai works? I'm kind of new at ai stuff, what I want to do is similar to battle royale but all players are ai. They will have to find food or team up etc. I guess state machines are what I have to look at?

jaunty raft
pure tide
#

just in terms of best practice, should i handle sensatory checks from an ai in a behaviour tree, or elsewhere?

#

was debating handling the ai doing its sight/sound checks in a behaviour tree vs having that handled by some other thing

novel pecan
#

Is there any thing to make an AI to pathfind on a 2D Isometric tilemap kind of already implemented on unity or anything similar?

final coyote
molten sequoia
tall void
left nymph
tall void
frail totem
#

Anyone know how to fix this error
My navagent is right on the navmesh

#

I have baked it twice to see if that would fix it but no

#

Does anyone know?

lunar plover
#

do you know navmesh how do i make it so the ai tries to be 5 units away from certain obstacles but for other obstacles maybe 2?

#

or am i understanding obstacle avoidance wrong

#

radius 0.5 means its trying to be 0.5 units away from an obstacle?

lunar plover
#

also when i try to use player it gives me an error something like setdestination can only be used on active agents that have been placed on a navmesh

alpine glacier
#

Like fully

lunar plover
#

yes

#

when i switch from default and player the default works player doesnt i baked it everything is blue

alpine glacier
#

Heres mine, this one works

#

Ill rename it to player to see

#

Still works

#

Maybe something here

lunar plover
#

its the same

lunar plover
alpine glacier
#

Oh right

#

Yeah thats strange

lunar plover
#

what type of movement you doing click to move or empty game object?

alpine glacier
lunar plover
#

and that gives u the error when using a new type of agent?

alpine glacier
lunar plover
#

i get a different error

alpine glacier
#

So basically same as u

lunar plover
#

nvm

alpine glacier
#

The first one is similar

lunar plover
#

i didnt see that lol

#

bro why do people need to make these things so annoying to use

alpine glacier
#

Idk lol

lunar plover
#

well if anyone can help pls do

carmine wigeon
# lunar plover well if anyone can help pls do

I was literally trying to solve this very issue yesterday and eventually figured it out. Are you baking/creating a NavMesh at runtime for the Player (not default) NavMesh? You have an Agent of the new type, but I think Unity is treating them completely different for navigation purposes so you'll need to create two (or one of only the Player type at the very least)

carmine wigeon
# lunar plover well if anyone can help pls do

Yeah, I didn't actually have both NavMeshes working in tandem but I would have felt really stupid if what I told you wasn't true so I needed to finish my own stuff to make sure. Here are some screenshots. NOTE: I'm using the Experimental (lol) package. If you aren't, your approach might look a little different as I need to change the mesh at runtime pretty frequently.

#

These components are on the same gameObject (In my case, representing the floor of the world in its entirety)

carmine wigeon
#

You've got two NavMeshAgent types, default and Player

lunar plover
#

yuo

#

yup

carmine wigeon
#

To get Player to work (as you said default is working already), you'll need to bake TWO NavMeshes

#

One bake for each Agent Type

#

At least, assuming you're using the Experimental tools for getting the NavMeshSurface

lunar plover
#

yes i tried that but what i was doing was prob wrong i just clicked bake and it was blue but it wasnt working still

carmine wigeon
#

Okay, yeah sorry, sounds like you aren't using that. I'm also then not sure how you bake for the other Agents with the default stuff because it lets you create the Agent types in the agent window...but then not bake the mesh ahead of time for that particular Agent? That seems fundamentally broken

lunar plover
#

yeah i saw that on youtube

carmine wigeon
#

I'd recommend grabbing the Experimental package. to be honest, it is a little confusing, but I think it just...makes doing things easier as opposed to shoving a square peg into round hole that it seems like the default brings

lunar plover
#

fr lol

#

yeah ill try that

carmine wigeon
#

Yeah, then you can just slap a NavMeshSurface(s) onto your primary surface and build on Start or whatever and it'll just work.

#

if (InitialMesh == false) { NavMeshSurface[] navMeshes = Floor_MasterNavMesh.GetComponents<NavMeshSurface>(); foreach (NavMeshSurface surface in navMeshes) { surface.BuildNavMesh(); } InitialMesh = true; }

#

Once you get to that point (there's probably another, better way to iterate through but whatever), that's the entirety of my code to build the initial NavMesh that I call on 2nd frame.

#

(Floor_MasterNavMesh is a reference to the object that had those two components in the screenshot I sent earlier)

#

Also because everyone and their mother was giving different answers, the actual import is, for the version that I pulled yesterday at least for the extra features.
using Unity.AI.Navigation;

You'll need UnityEngine.AI for the base NavMesh stuff though if you're doing anything else via code.

left nymph
#

baking without the navmesh surfaces should actually bake an individual navmesh for each defined agenttype

carmine wigeon
#

I needed to import it for 2022.1.23. Eyeballing the 2022.2 beta and seeing if its in tehre

left nymph
#

2022.2 is out of beta

#

i cant double check right now as im not on PC sry

#

but i had to remove the package i got from github

carmine wigeon
#

I was running an ancient version of Unity Hub not realizing it wouldn't just update on its own and it had an out of date editor version list. UnityChanOops

#

notlikethis Well HmMmMmMmmMm. I guess your mileage my vary then. I should PROBABLY look into updating the build version since I'm so early into my own project.

left nymph
#

IMO 2022.2 is not that stable yet. but im using DOTS so that might be why. if you dont have to switch i would wait a few more versions

carmine wigeon
#

Ah yeah, I made the switch from GMS to Unity like two weeks ago for trying something serious. It looks like the Nav system is the same set of classes so hopefully parameters/expected behaviors won't change too much if I make the switch.

left nymph
#

it was a 1:1 replacement. no troubles switching for me

carmine wigeon
#

Ah well that's good and convenient. And I see about the baking. My entire project landscape is procedural so I have nothing at all to bake with the editor on my own project.

left nymph
#

yes same. i do runtime generation too. the only difference is calling UpdateNavMesh instead of pressing Bake if you are using navmeshsurfaces

carmine wigeon
#

You don't need to bake it the first time?

left nymph
#

no

carmine wigeon
carmine wigeon
#

Well that lessened an initial 'load/stutter' I had by like 2 seconds, thanks.

alpine glacier
#

he regularly blocks himself, and when he doesnt, he still lets trees hit him from the sides as he walks

#

i alraedy tried all settings on navmeshagent

carmine wigeon
#

Are your trees marked in some fashion for the NavMesh (either through Obstacle or being set to a Non-Walkable area)?

alpine glacier
#

no theyre terrain trees, not sure how can i set them to such in this case

left nymph
#

and you can also use NavMeshBuilder.UpdateNavMeshDataAsync for less stutters

carmine wigeon
#

When you say build sources, do you mean the NavMeshData that's supplied to UpdateNavMesh? If so, this might be my ignorance showing, but I only ever call it once per surface. And yeah, I'm using the Async version.

left nymph
carmine wigeon
#

Oh okay gotcha. Yeah, I'm just having the Surface components do it themselves and they're figuring it out...well enough. I have destructible walls that I need to recalculate navmesh for, but that makes sense if there's entire areas that didn't exist before that you're loading in after, yeah

alpine glacier
#

i tried both of these on terrain trees and player just walks through them even though i added rather big volume (3x3x3 meters per tree)
https://i.imgur.com/4i4dQOz.png
so seems these arent respected once converted to terrain trees. ill try to use trees as prefabs (instead of unity trees) but theyre slower than trees

lunar plover
#

what is height/length?

stone owl
lunar plover
#

i thought this was this?

stone owl
#

This is the new ai components or third party? I don't recognize

stone owl
#

see Shape above

lunar plover
#

the yellow is the shape?

dusk path
#

so I'm reading through the documentation on NavMeshAgent and I see:

Agents reason about the game world using the NavMesh and they know how to avoid each other

Yet my NavMeshAgents.. don't avoid each other?

#

What am I missing?

lunar plover
#

what is the difference between radius and height and height/length

#

what do they do

jaunty raft
lunar plover
#

bro

lunar plover
#

like why

jaunty raft
#

2 what?

lunar plover
#

height/length radius and height

#

like

#

whats the point of height/lenght

jaunty raft
#

radius & height defines a capsule

lunar plover
#

what does that do

jaunty raft
#

?

lunar plover
#

the capsule

jaunty raft
#

there is literally a picture of it in your screenshot

lunar plover
#

YEAH BUT what does it represnt

jaunty raft
#

its used to check if the pawn fits through a gap on the navmesh

lunar plover
#

??????

#

pawn?

#

pawn you mean player and why doesnt the height and radius do that

lunar plover
#

you arent explaining anything

#

thats the height and radius the green capsule

#

right?

#

then what is height/length? what does that do it cant be the samje thing

jaunty raft
#

its the height of the virtual capsule used to generate the navmesh padding to any colliders in the scene

lunar plover
#

isnt that height and radius?

lunar plover
#

thats height and radius i dont see any green capsule

crude fjord
#

And how would I modify the config.yaml file to use SAC instead of PPO?

left nymph
crude fjord
#

Oops! Thought I was there already

#

cheers

latent cloud
#

Multiplayer ai does anyone know how to do this

left nymph
sullen prism
#

@pulsar wasp

#

oop wrong server

delicate drift
#

not 100% sure why... maybe check the search radius and turn it down?

sharp grove
tame drift
#

Not directly related to AI, my AI works as expected, but the navmesh got this look after adding obstacles, and it won't go away. It still functions normally, but it gives me an aneurism every time I move the camera.

sharp grove
#

im not sure what info is required for help

#

I tried it with a diffrent thing and it has the same problem

#

Idk if the right side is required so just in case

dusk path
sharp grove
stable bronze
#

Is DOTS the main go to for large amounts of navmesh agents? I have tried setting it up a few times but keep running into errors with these packages

sharp grove
dusk path
#

yea this discord seems to be in a similar state to Unity itself..zombie mode

viral ledge
#

Anyone here use the Nav Mesh Components package? Having some issues related to baking navigation and I'm having a hard time understanding what the issue is.

#

I have these occasional narrow "trenches" baking to my nav mesh using the default settings. Using renderers not colliders for baking. I can kind of get around it by changing things like the voxel size or tile size but it's unclear to me what the implications are and why the default values would create these trenches.

#

The terrain mesh itself is fairly low poly and clean. Not sure why there would be sections completely "cut" away from them. Like this.

left nymph
viral ledge
#

I was able to get better results by playing with the tile size and voxel size of the surface

#

But a little unsure of why the default values would be causing that

left nymph
viral ledge
#

Or they did before tweaking the values above.

left nymph
viral ledge
left nymph
#

@viral ledge hmm ok... so if you need to use the surface instead of the old way of baking navmesh i guess you need to do some trickery. how about having your actual character representation object on a child gameobject of the Character Object. you let the navmeshagent drive the character object but the representation objects height is controlled by a script raycasting against the terrain to figure out the needed height.

viral ledge
viral ledge
left nymph
#

smaller voxels make the navmesh more accurate in every point. baking takes longer though.

quiet fossil
viral ledge
quiet fossil
viral ledge
quiet fossil
#

Ah yeah I see what u mean

left nymph
#

oh lol :

#

heightmesh should be possible

#

@viral ledge

viral ledge
left nymph
#

you need 2022.2 version

viral ledge
#

Ohhhh. Too bad I've been waiting for it to come to LTS.

#

Hopefully soon.

left nymph
#

are you that deep in production that you cannot update?

#

just cause its not LongTermSupport doesnt mean its not good to use. its not beta anymore

viral ledge
#

Yup I know, but I'm sure that it's coming to LTS very soon it's been on 2021 for a long time

#

We've got the game installed on a few machines and all sync'd up in Git. Would rather wait to update when it's released. Glad to know that the component based workflow is finally out of preview though.

alpine glacier
#
    {
        int randomTarget = Random.Range(0, spawnloc.Length);
        GameObject enemyn = Instantiate(enemyobj, new Vector3(0, 0, 0), Quaternion.identity);
        enemyn.transform.position = spawnloc[randomTarget].transform.position;
        NavMeshAgent agent = enemyn.AddComponent<NavMeshAgent>();
        agent.enabled = true;
        enemycount += 1;
    }```

hi, I use the code above to spawn enemies in random locations, but the spawned enemies don't move, even if they have nav mesh agent. I want to mention that the rest of the manually made enemies go on the map perfectly
halcyon delta
#

also there is a lot that couldve gone wrong

sharp grove
#

I did use the exact script in the video. I dont know what went wrong

frigid orchid
alpine glacier
left nymph
#

you probably want to call GetComponent instead of AddComponent

alpine glacier
alpine glacier
left nymph
#

oh im actually impressed it did something so basic wrong 0.o

alpine glacier
#

just like me

#

💀

frigid orchid
#

You should axiomatically assume it will have a minimum of one mistake and if you didn't catch it presume it's there and read it five times again until you do. Then once more.

#

It's a highly impressive AI but not for it's technical skills, if you had a junior who made mistakes like it does you would not be impressed.. 😄

wanton sand
#

Hi, I'm looking for some assistance using navmeshagent on the XY plane in Unity 2022.2.7. If anyone is able to do this, I would really appreciate some help. The upgrade seems to have broken what was previously working fine. I've included details here:

https://forum.unity.com/threads/navmeshagent-can-not-detect-nav-mesh-on-xy-plane.1403608/

trail cradle
#

Does anyone have an idea as to why carving a NavMeshObstacle out of the NavMesh would cause NavMeshAgent.path.GetCornersNonAlloc() to return an empty array for a period of time, even though the agent itself is still able to follow its path? I'm wondering if I might have found a bug in the AI system... 🤔

pure tide
#

for some reason the kiwicoder behaviour tree has a very negative interaction with the deep profiler with my current build, it starts generating "nullreferenceexception" if you refresh the deepprofilerwhiel its loaded. The error messages point towards the Update thing. Just wondering if anyones familiar with this and if theres any known fix?

#

i thought this was just something i was doing but i made a new/blank unity project (version 20.21.3.19f1), imported the kiwicoder behaviour tree and ran the test scenario and it still generates errors

snow agate
#

So i am new to ai, i want to make a simple bot that goes to collect an item, but avoid enemies which go towards the player, where do I start?

snow agate
#

nvm i found a good tutorial

ember cedar
#

Hi everybody I have a nav mesh agent and I want is when ever my player push the agent He fall down to the platform but he's not going down because he stack at the end of bake area

boreal prism
rugged garnet
#

hey guys, i've been following a tutorial but it seems out of date or something is wrong with my unity maybe? in this he has this but in mine I have this, no bake, no object in mine

verbal heron
#

hey guys! i am using a pathfinder script from the pathfinding package. the red parts are the areas the player cant move and blue parts are areas the enemy can move. i want the whole maze to be blue. how do i make this to happen?

left nymph
#

You bake the navmesh inside a NavmeshSurface Component on a Gameobject now

rugged garnet
#

yesterday I found out this way to do it but today baking just does absolutely nothing

red grove
#

Is it possible to bake the nav mesh bellow the water level to a different nav layer, when it is the same terrain?

left nymph
red grove
#

Seems to work, thanks 🙏

raw tiger
#
NavMeshAgent.remainingDistance
public float remainingDistance;
Description
The distance between the agent's position and the destination on the current path. (Read Only)

If the remaining distance is unknown then this will have a value of infinity.

How a distance can be unknown ?

left nymph
mortal umbra
#

i want my navmesh to be driven rigidbody controller

#

also it has climbing

#

what exactly should i do for it?

#

how exactly should i tap in and out of navmesh agent mode?

#

after all cimbing is something where you want position/velocity to be driven by controller/rigidbody

raw tiger
left nymph
left nymph
#

you take the targetPosition and calculate points in a circle around that position. then you use those points as destinations for the navmeshagents of the units that should surround the target. not sure how else to answer this question sry

raw tiger
left nymph
#

you could maintain a list of SurroundPoints on the Target and when an agent gets one of those points you set that point to occupied for example. but there are literally 1000 ways to solve this. depends on all your other systems and AI

arctic pond
#

Hey everyone! First time poster here with a question I hope someone can help me with!

The short version is "one of my scripts runs faster in the editor than in the player." I've researched / googled others facing similar issues, but sadly their fixes did not seem to work for me.

The longer version: I have a function in a script that I call to determine what my AI agents want to do next. When I call this function while playing the game in the editor it completes in about 0.1 seconds, which is acceptable for my game.

However, when I perform this same operation in the player, it takes significantly longer to complete -- around 3.5 seconds. This amount of delay is unacceptable for my game.

Through using the Unity profiler and C# diagnostic tools I feel confident I've isolated the slowdown to this specific function. I've verified that the editor and the player are targeting the same quality settings ("fastest").

To further verify that this script is the problem, I made a separate Unity project that is basically only this function call (no graphics or other game objects; just a button that runs this function) and experienced the exact same behavior -- it runs fine in the editor but not fine when actually built.

I've also produced logs to confirm that the output of the function is the same in both the editor and the player. Indeed, they produce the same output and perform the same number/types of operations.

At this point I'm not sure what to investigate next. The only hunch I have is that the editor has something preloaded that my script is using that isn't preloaded in the player (and it is this "thing" spinning up that is taking the extra time), but that theory isn't particularly substantiated by the profiler, and I wouldn't know where to begin looking to address it.

Does this sound like anything anyone here has ever encountered before? Super happy to provide profiler screenshots or logs or answer any followup questions!

Thank you in advance!!

open tulip
# arctic pond Hey everyone! First time poster here with a question I hope someone can help me ...

I did have an issue like this but i don't know if it's related to your function : are you using FixedUpdate in it ? Because if you do, and change the timestep, and checkmark Vsync, it can cause some issues 😅
https://forum.unity.com/threads/game-runs-in-slow-motion-in-build-compared-to-editor.1194991/

arctic pond
left nymph
arctic pond
# left nymph is it possible for you to use burst for this performance critical function? neve...

Thank you for the reply! I confess, I actually haven't heard of burst before. But yes, I'd love to experiment with a different compiler.

Ah! This is the burst you're talking about, right? https://docs.unity3d.com/Packages/com.unity.burst@0.2/manual/index.html

I don't have any prior experience with the unity Job system yet... but if there's a chance it might help me out here, I'm excited to start learning all about it, haha!

Thank you again! It feels good to have a new thread to pull on. I'll let you know how it goes.

left nymph
#

there are quite some restrictions for code to be burstable. you probably shouldnt care about jobs and multithreading for now

arctic pond
# left nymph there are quite some restrictions for code to be burstable. you probably shouldn...

Heh, well at this point I'm kind of just eager for any sense of forward progress, even if what I end up progressing down turns out to be a rabbit hole 🙂

But thank you for that link. I'll definitely read up on all of it. So am I understanding correctly that it's possible to leverage the burst compiler without also using jobs and multithreading? Sorry if these are naive questions, this is all new to me!

left nymph
#

Yes Burst,Jobs and the EntityComponentSystem are usually referred to as DOTS but you can use any of those individually (though using ecs individually wouldnt make much sense)

wheat turtle
#

i am trying to create an AI for my fighting game (like shadow fight)
Any idea how to implement that, any resources would help a lot

carmine wigeon
#

Nevermind, I think I just implemented a garbage version of behavior trees without the ability to communicate with one another and need to fix it. Cool

sturdy sail
#

Hey, I was wondering if I could get some help with A* grid based pathfinding

#

What I think is an easy thing to figure out, I have been stuck on this problem for almost a month now

left nymph
#

post the part you have problems with. its hard to help you if you are that vague

sturdy sail
#

I'm making a rougelike game and we're using A* for our enemy pathfinding. I want to make it so in the rooms where the enemies are placed, they won't do anything until the player enters the room and the room is fully in camera view

#

All the rooms are prefabs and I can't just add an A* grid because I would get an error saying only one instance is allowed, I tried making the grid massive, but that would just make enemies in 10 rooms away phase through and chase the player

#

And I can't pre make the grids and assign enemies to said grid because I can't be sure the room will always spawn where I set it

left nymph
#

so you are already using arongranbergs package?
i dont know how expensive it is to rebake the Navmesh but how about just baking the navmesh in a certain distance around the player and update it every once in a while?

#

if the update works incrementally this should not be expensive at all

#

I dont have much experience with the package (i just knew it had gridbased pathfinding) but i did some runtime navmesh generation with unities navmesh which worked really well. i cannot imagine that package beeing worse at it

sturdy sail
#

I can try that and see if that works

fast cape
#

So,A youtuber created a script that you can use so that an enemy ai will chase you.The problem is,when I get close to the enemy,instead of chasing me,it goes into a corner.I checked the nav mesh agent,the script,and the gameobject.thanks for the help.

sharp grove
hollow abyss
#

Does somebody has experience in writing 3D spaceship navigation/battle AI?

potent ginkgo
#

is there someone who have implemented self play using mlagent toolkit of unity?

fathom arch
jaunty raft
fathom arch
#

True, I haven't really studied game development from books but I thought I'd try it out

pallid rover
#

Hey guys! Wanted to share my new devlog on my Unity game where I am training an AI to learn to dodge bullets using ML-Agents/Reinforcement Learning! I am kinda surprised myself how good it plays after proper training... If anyone is interested in this space, do check out and let me know what you think!

https://youtu.be/mIzbiO-7Jfc

This is Devlog 3 of my 2D projectile-dodging Unity game where I am using Unity's ML Agents package to train an AI with Reinforcement Learning. In this one, I document how I tackled the issues I had been having with training ML Agents on a high time-scale in a complex physics environment that uses a bunch of coroutines, by implementing a more sta...

▶ Play video
clear rain
#

anyone have any information about AI NPCs that can interact with voice?
for the time being I'm using Convai, maybe there are other suggestions?****

radiant crag
#

I want my creature to have a run animation that starts when the scene starts but it doesn't animate, could somebody help me?

radiant crag
#

I got it to work somehow

left nymph
dapper moon
#

Hi, sorry, I'm new here, I have a simple question: I don't understand how the built-in AI system of Unity is supposed to be practical. When I have different enemy types which have different sizes and behaviours, It seems like I can only bake one agent type into the navmesh? How can I support different agent types?

left nymph
#

It would be nice to be able to define multiple AgentTypes in a single NavmeshSurface which then bakes multiple navmeshes automatically but the technology is not there yet. maybe in 10 yrs.

dapper moon
left nymph
left nymph
#

if you are on 2022.2 its used by default

dapper moon
#

oh, Im on 2021.3.9f1 or something like that

#

thanks! That's very nice, I didn't know they updated the ai stuff, finally!

left nymph
#

its not really an update. those navmesh components were available for a long time and did indeed improve the Navigation workflow. they now just integrated it as the default way.

#

i really do hope they'll improve Navigation further at some point. whenever i use it its lacking something i desperately need 😄

slate basalt
#

hey guys im working on a alien type enemy ai, i was trying to do it to wander, and it was not working so i tried on capsule and it works perfectly fine, i dont know if it is the navigation bake or the nav mesh agent or the script.. Help please

rich pendant
#

Hey there! Basic question, I have an AI script using NavMesh that wanders around, then if the player is in a certain range it chases the player. But I have an issue where even if I set the player game object to inactive, the AI still tries to chase the player. Any fixes? My script: https://pastebin.com/gvMeUgA6

left nymph
#

so an easy solution to that would be to just check if the player is active and if so only then follow him. else fall back to wander around

#

but generally speaking id introduce something like a "isInvisible" state for the player that you check instead of having to disable objects.

rich pendant
#

thank you! ill check it out tomorrow (its already 4am) because im beat. again, thank you

rich pendant
sleek owl
raw tiger
#

i don't understand this panels. Radius / height is the same ? Someone can explain ?

zealous mantle
#

Radius is the radius of the collider. Height is the height. What is the confusion? They are not the same.

raw tiger
left nymph
raw tiger
zealous mantle
#

I don't understand. The radius of something relates to how wide it is. The height relates to how tall it is.

left nymph
#

oooh i now get the question lol. They are asking why there are multiple places where you define heigt and radius and what the difference between them is

#

@raw tiger Okay so in the Agents tab you define how big a specific agent type is.
In the Bake Tab Height/Radius referes to the default agent. The Agentsettings should override that.
Those settings are for Baking the navmesh.

NavmeshAgent Height/ Radius is defining how it behaves with obstacles and other agents which are not baked into the navmesh.

raw tiger
left nymph
#

i think what you see is all baked navmeshes stacked onto each other for every agent.

#

which is really useless 🙂

raw tiger
#

**NavmeshAgent Height/ Radius is defining how it behaves with obstacles and other agents which are not baked into the navmesh. **
How he know the radius and height of other elements that aren't on the navmesh ?

left nymph
#

i think you can get around that when you use the new version.

left nymph
#

since unity 2022.2 its called AI NAvigation package and has the old navmeshcomponents package integrated by default

raw tiger
#

So he only combine the package on unity + the package you can download on github. nothing new ?

left nymph
raw tiger
#

Ok thanks.

onyx patrol
#

Hello ✨

#

I'm currently looking to joints with MLAgents. I'm having some trouble wrapping my head around Configurable Joints and the Crawler/Walker example. I was wondering if anyone could spare some time to help me with a few issues I am having with Configuring the CJs? It would be much appreciated 🙌

left nymph
onyx patrol
#

Thank you, sorry

mighty onyx
#

hey guys has anyone here used behavior designer? im specifically asking about the Can Hear Task?

grand socket
#

anyone know how i can approach 2d navmesh navigation. With Unity 2021 I was using something i found online "NavMeshPlus". But in Unity 2022 some stuff is said as being obsolete and so i cant do it the way i did it with 2021.

south nymph
#

how would i make an enemy follow a path in 3d? i wanna try making a game where guards have a set path and if they see you then theyll kill you

shut jasper
sand pumice
#

anyone know why i can't get the navmesh to include terrain trees?

#

i've got these components on the tree prefabs but they dont do anything

#

i may well be using them wrong

#

Here are the settings of the navmesh component

round bronze
#

Anyone know of an AI tool for creating 2d game sprites/walk cycles?/pixel art?

left nymph
sand pumice
#

pain

#

got chatgpt to make lil controller that works well enough

leaden perch
outer night
#

What tutorial for AI - zombie AI - you recommend?

deep socket
wise cliff
deep socket
#

parent him to an empty game object

#

put the navmesh stuff and all that to thr empty gameobject

#

and than just rotate the model that you patented

solar skiff
#

Question, does anybody here know to make an advanced enemy AI like:
Strafe Left/ Strafe Right : While the target is within attack range but you are on cooldown
Move Towards: You are far from your current attack range, but not too far to pursue
Move Away: You are too close from your current attack range, or you are blocking, dodging, or in cooldown with enough max range of the current attack
If somebody knows, please let me know. Thank you so much

left nymph
#

statemachines and Behaviour Trees are more on the "scripted"/"hardcoded" side of AI while the others can produce good behaviours even in unclear world states

solar skiff
#

The enemy AI that I'm using is a Statemachine. I want to put to put them in a battle state, but the NavmeshAgent.setdestination isn't working for me.
For starters, I would want that the enemy AI circle the target while strafing

tame birch
#

Does anyone know where the Unity AI that was just announced, where the discussion is occuring? Here? machine-learning forum? somewhere else specific to it? I know it hasn't opened up yet

left nymph
regal bison
#

I have a question, I have a problem where my companion AI sometimes block my way sometimes, I've tried to multiple ways to make them step out of the way, but it just doesnt work right
what could be a good way to make this possible?
also, to note, I am purely navmesh, not root motion

outer night
#

Dijkstra or A* ?

raw tiger
outer night
#

For example the agents should avoid physics controlled objects, such as crates and barrels while moving.

#

Now we have a working crate that is physics controlled

#

For example ....

raw tiger
#

Thanks i know how to read that don't answer to my question.

raw tiger
outer night
#

Its look like animation problem

#

transition from idle to walk /run

#

try debug speed and u see that mesh agent don't start walk slowly

#

they just go

raw tiger
outer night
#

if you say so then ok 🙂

fair ridge
#

I am having some trouble after re-doing my AI's, they dont work untill I change their offset and back again, weird behaviour anybody knows what could be the problem?

left nymph
#

@fair ridge Look at the debug warnings. Should be telling you they are too far from the navmesh

outer night
#

look at this

#

i think you have problem with agent size settings

#

@fair ridge

fair ridge
#

@left nymph SetDestination just does not return true, thats all I can gather from it :/
@outer night I edit the base offset in the video if you look on the right, it works after i move the offset up to 1 during runtime 😒

outer night
#

change size ;]

#

radius and height

#

and show navigation tab with agent settings

fair ridge
outer night
#

try change radius and height

#

and how u set box collider?

#

and why u use box not capsule?

fair ridge
#

Could be yeah, im redoing my AI's could be I changed the collider, ill test when i reopen project

raw tiger
#

how do you pause your logic when you need to wait a frame after desable nav mesh agent ostacle before moving with nav mesh agent

outer night
#

u can use bool state

#

like isMoving, isSearching, isAttacking, isPatrolling etc

raw tiger
outer night
#

I haven't worked with navMeshObstacle yet, but did u add this component to your enemy?

raw tiger
#

yes

outer night
#

why?

#

its allows you to describe moving obstacles that Nav Mesh Agents should avoid

#

so this component is for moving obstacles

#

like doors,

#

What do you want to achieve by adding this?

#

opponents don't step on each other?

raw tiger
#

for ai avoid all together and surround me

outer night
#

to surround you u can make circle around your player with spot for attacker

#

if its free attach enemy to this spot, if not keep attacker on distance from player

#

something like that

fast pike
#

I am working on a college project where I will use reinforcement learning to manage a traffic light intersection. I don't have much knowledge in Unity ML-Agents, and I'm really lost. I have an idea of what I need to do, but I'm trying and not able to get the agent script to work the way I want. Can someone help me? There are several questions, so it would be difficult to post everything here, but I can provide them if needed.

#

Basically, the agent will act by "pressing" a switch, changing the traffic lights

steep vale
#

What is the best/easiest solution to handle multiple agents using a-star?

Currently im just having the agent look at the next node in the path, if its occupied, look for another route. But that seems to me that it's running a-star stupidly unnecessary amount of times. Especially when all agents are trying to get to their destinations at the same time. I even run into a scenario where two agents would just bump their heads together, walk backwards, then bump heads again. Probably because they find a new path and then realise that the old path was actually better and then they're stuck in an endless loop.

left nymph
left nymph
steep vale
# left nymph this is where you need the concept of local avoidance. A* just finds the optimal...

I actually did sort of come up with some solutions to my agents.
In my scene, alot of the times either the destination tile or the source tile is surrounded by other agents. So I opted to make a bi-directional A*, if either of the opened-lists run empty because that end is surrounded by occupied nodes, I can quickly halt the A* and do something else instead.

Also, I did sort of implement an avoidance pattern. But I was tired and just told the agent to skip the next node in the path and find a new path to the second next node. After which I'd add it to the current path.

However, as I am writing this, I realise that might not be the best option.

fast pike
neon canopy
#

hi

#

how to use unity ai?

orchid marsh
balmy hawk
#

lmao

#

gpt bros have arrived

neon canopy
jaunty raft
neon canopy
orchid marsh
viral ledge
#

So I'm working on some navigation behaviors for my enemies. What would be a good way to have a nav mesh agent calculate a path to walk around other agents? I want to keep my enemies spread out further from one another rather than bunching up. I can increase the avoidance radius, but that just makes the agent that is in motion just push the other agents out of the way rather than having the agent in motion walk around the other agents.

left nymph
viral ledge
#

I realized after looking further into it that having the agent push the other agents might not be such a bad thing. As long as the pushed agents animate to look like they are backing away to make space for the agent in motion it should work for my scenario after all.

left nymph
neon canopy
left nymph
#

neural networks are just not that good for game AI

left nymph
#

for scripted AI behaviour trees and for fuzzy AI utility AI

neon canopy
potent totem
#

I've got a super weird question: does anyone know an easy way to obtain the size of a navmesh area?

#

I'm trying to compare which of 2 discrete areas is bigger and I don't know where to start

harsh shell
#

I'm trying to make a navmesh to find a player in a maze, but it keeps doing things like getting stuck in walls, going really fast when next to a wall, and not going fast enough normally. Does anyone know how I could fix this?

left nymph
outer night
sterile moat
#

what tools are available for free to create 3d models / animations with ai.

harsh shell
#

👍

ashen smelt
#

Is there really no way to exclude volumes from being processed by the navmesh generator other than a box shape?!

robust tree
robust tree
outer night
#

lately there have been a lot of questions about surrounding the player with opponents - I found two videos - maybe they will help 🙂

hidden stirrup
#

I need help solving errors

latent cloud
#

how to create an ai that goes after the nearest player with photon?

bleak gyro
latent cloud
#

not really

#

ive looked

bleak gyro
#

I dont know much about AI but unity has an AI navigation package that could help

latent cloud
#

good to know

bleak gyro
#

There are plenty of tutorials on how to make an enemy AI just none as far as I know that incorporate photon

latent cloud
#

ill just make my own system

bleak gyro
#

Ok

wild swan
#

when giving ai set destination it takes a small delay of 2-5 seconds before executing, any idea why?

halcyon delta
#

Code please

wild swan
wild swan
#

could it be a hardware issue? project runs slow

left elm
#

guys how does the navmesh agent work?

#

so sepcifaclally what i mean im following a course where the instructor makes an RPG. In this course he makes it so that if he clicks on the surface the player moves there. and he doesnt use a navmesh surface rather he just makes all the objects which we wont be able to click on static. how does that work???

left nymph
#

and its gets worse the more paths you need to get at the same time. so if you have a lot of agents it will take some time until each one is starting to follow a path

worldly lance
#

for some reason I cannot bake navmesh on stairs.
I tried changing the agent radius, jump distance, step height and max slope but nothing seems to affect it.
the only solution I found online was to put a slope instead and hide it's render, but that looks junky. :)
here is my current result: (even on the small square on the right the navmesh cannot climb.)

#
left nymph
worldly lance
left nymph
#

ah ok i see. yes there should be a navmesh island there. weird

worldly lance
#

baking with stairs that have 3 times the radius just makes another island /:

left nymph
#

by island i mean there should be a navmesh that is not connected to the main navmesh on those big stairs

#

did you mark those stair objects as obstacles or sth?

worldly lance
left nymph
#

oh i dont remember how it is with the old workflow. i used navmeshcomponents for years now

worldly lance
#

am I using an old workflow? 😂 I can upgrade if you have something better

left nymph
#

in 2022.2 it is now the standard

#

look at AI Navigation package

worldly lance
#

I am using 2021.3 nice

worldly lance
worldly lance
#

does it replace the current navigation package I have or does it add to it?

left nymph
#

should be a seemless update. i dont think it removes the old workflows but only adds the new ones on top

#

navmeshsurface component is what you need to look into first

worldly lance
#

wow, didn't even had to do much, the package just fixed everything. thank you! @left nymph

#

by the way, I just added one surface navmesh component to the stairs and it baked the whole world, is this normal?

left nymph
#

i usually use a empty gameobject just for a navmeshsurface

worldly lance
#

that is awesome, amazing how unity handles all of this flawlessly

#

thanks :)

left nymph
worldly lance
# left nymph haha lets see what you'll say as soon as your agents need to do some none basic ...

It gives me a lot of power actually,
most of the work goes into pathfinding so dodging and jumping can come from bullets that act as live moving obstacles
and if I want to make a cutscene or something like that I can just move to a place -> play animation -> move to another place -> run whatever code I need with animation and checksphere every time I reached the place. this tool is amazing.

chilly cairn
#

For a new project, should I be using the built-in navigation system or use the AI Navigation package?

#

I can't even seem to find it in the package manager on unity 2021.3.22f1

left nymph
#

for new projects id also always start with newest editor version (ignoring alphas and betas)

#

you dont need LTS when you are not in production yet

chilly cairn
#

good point, thank you!

alpine glacier
#

Are there any settings I can adjust in NavMeshComponents to improve the performance of pathfinding calculations? I have a Navmesh that will eventually be in the ballpark of 1000 x 1000, so performance for NavmeshQuery is critical

alpine glacier
#

There really needs to be documentation that the voxelSize drastically affects the latency of pathfinding operations. When I increased the voxelSize from .166 to 1, the latency of pathfind operations decreased more than tenfold. Even though this might be intuitive to some, since larger voxels means fewer voxels, and thus fewer calculations, the lack of documentation would make people think that there's no performance cost for voxels

lilac spire
#

Hey! If I click on "Bake" nothing really happens.

#

Thats why this code doesnt work.

raven rapids
#

Are you using the AI Navigation package?

#

Or are you just using the built-in system

lilac spire
#

I mean it is in

#

I didnt import anything like that so maybe not, how can I?

raven rapids
#

The new navigation package makes it a little nicer, IMO

#

You put NavMeshSurface components in the world and bake them

raven rapids
#

do you have Gizmos enabled in the scene view?

lilac spire
#

I do

raven rapids
#

I forget exactly when it shows you the surfaces

lilac spire
#

How can I import that package?

#

Because now it doesnt really work, it thorws me an error

raven rapids
#

that is very vague

raven rapids
lilac spire
#

2020.3

raven rapids
#

the AI Navigation package wasn't out of experimental yet in that version

#

might as well stick with the default for now

raven rapids
lilac spire
#

There is no valid nawmesh, thats why it does give this error, but I cant use "Bake" for some reason, nothing really hapepens when I use that.

lilac spire
#

I got it!

#

But how can I make multiple enemies? Not just one? 🙂 @raven rapids

raven rapids
#

ah, good

raven rapids
lilac spire
#

Sure, and what if I want to do a radius?

#

Oh I have right?

#

Its in the naw mesh agent

undone gust
#

hi guys is really posible to make it happen this way ? the goal is to an avatar to walk you in that path ? currenty i can make it happen , i am using ai navigation , unity 2021.3.17f

undone gust
lilac spire
#

Hey! I've got this here, but it only works if I start in that position where I'm less than 20 meters away from the enemy. So if they are further, it doesnt work.

floral sleet
mellow garden
#

Is there any way to pathfind to the closest spot for the agent, but then stop? Stopping distance doesn't get as close as possible.

coral cargo
#

is it possible to save prefabs with navmeshes?

#

in my game you can create houses and go inside of them

#

but my npcs ai need to enter and leave them when needed

#

for that i need the house itnerior be a pre baked navmesh

jovial remnant
#

Anyone working on something using the Generative Agents: Interactive Simulacra of Human Behavior paper?

left nymph
coral cargo
#

ooh

#

damn thats great

coral cargo
#

is it possible to make a nav link instantaneus?

raven rapids
#

you can tell the link to not move the agent

#

and then move the agent on your own

coral cargo
#

hmm im tryign to make navlinks afeter the iset to rebuild hte navmesh

#

but my editor crases

dusty kernel
nocturne osprey
#

using navmesh how I can I make the enemy move behind the player. I want it to collide on the way but I dont want it to just stay inside the player

floral drift
wild crystal
#

Im having some issue with a nav mesh and a nav mesh agent, however with the circumstance Im in idk if this server could really help me

#

if ur gonna respond plz ping me btw

#

I have this which generates the meshes fine, however when my agent goes through a door object, it suddenly becomes unable to cross back through that door or any other doors

#

I cant really, edit anything unity would be able to do either, since im doing this all externally you could say

#

(for moving the AI its just scp096navMeshAgent.SetDestination(currentTarget.Position);)

left nymph
# wild crystal

you are baking seperate unconnected navmeshes because you are using multiple navmeshsurfaces. you need to use a single navmeshsurface and supply all buildsources of active rooms to that.

#

then you dont need to connect anything with navmesh links anymore.

#

whenever a door is opened just rebake the navmesh at runtime with UpdateNavmesh(). this is incremental so it will only add the new room and does not recalculate the old ones

wild crystal
left nymph
olive vessel
#

"To sum up, five of the top programming languages for AI development are Python, R, Java, C++, and Julia"

I hate this article, it recommended Java over C# and C# is basically Java and more...

raven rapids
#

looks like blog spam

alpine glacier
#

Hello everyone
I have a problem with my car AI, so I placed the Standard Assets because it has a waypoint system to make a car ai work and move and all that, but I want to put a custom car rather than unity's car
so that's what I did, I used the same script as unity's waypoint car and placed everything to its corresponding units
but when I tried to test it, the car wasn't moving at all but the unity car was, any idea as to why?

#

here is the video to show what I mean

#

Nevermind, I forgot to set a target on Car AI Control

#

my fault 😅

glossy valve
#

hey guys so working on implementing my client/server architecture stuff and I'm realizing that I won't be able to do pathfinding and LOS for my AI entities without some kind of copy of the mesh information in the game client. How is this normally handled?

left nymph
glossy valve
#

It doesn't that's the reason I asked the question. On the server I won't have the meshes used for collision and line of sight stuff.

wild crystal
#

I have a problem where my agent slows down when crossing a link between 2 navmeshsurfaces? is there a known reason for this?

#

I turned off autoTraverseOffMeshLink

#

and have this script for it

raw wing
#

I made an AI using navmesh and when I added new walls, they don t get recognized and the Ai is walking through them

#

nvm I had 2 nav mesh

fringe crag
#

does anyone know if the experimental runtime navmesh package is still in development and receiving updates?

left nymph
#

its called AI Navigation package now

fringe crag
#

thank god.. been leaning on it a little too heavy for an experimental package. that makes me happy to hear

sand kraken
#

Anyone know why creating a new Agent Type fails to see navmesh? (yes I've baked the mesh.)

severe eagle
#

Hello everyone! I am new to ML and am trying to follow a example I found here: https://towardsdatascience.com/an-introduction-to-unity-ml-agents-6238452fcf4c

I've done my best to follow the example exactly. They recommend training for 300k epohcs and show BigWallJump brain has leaned the policy very easily. However the results I get are somewhat different and the cumulative reward had plateaued even after 1M epochs. The agent has learned to bash it's head into the wall and that's about all. To the best of my knowledge all hyperparameters I used are identical to the website example and I made no changes to the example project or any of the code. I simply loaded ML agents example project, deleted the brains and started training, but it just won't train.!! What could I be doing wrong?

Medium

We’ll learn how Unity ML-Agents works and at the end of the article, you’ll train a RL agent to learn to jump over walls.

left nymph
woeful helm
#

how do you stop navmesh companions from shaking

left nymph
#

@rustic obsidian you could pin a link to the new AI Navigation package that now has navmeshcomponents integrated (after unity 2022.2 i think)

left nymph
woeful helm
#

i have the problem when i accidentally run to the companion

rustic obsidian
left nymph
woeful helm
#

help?

lone tundra
#

Say I have two groups of navmesh agents, and I want each one to happily clump up with their own kind but to avoid the other... what's the best way to set that up?

noble fog
#

I would probably introduce gathering points, when they reach their destination, create a gathering point and make sure it's not too close to opposite group's gathering point.

#

And when in range of a gathering point redirect there straight away.

lone tundra
#

That's fine for general purpose wandering but specifically these are two types of thing that can be herded around and I want the two types to clump up and avoid each other while still chasing a goal

#

while navmesh obstacles would work what I'd really prever is dynamically setting navigation areas

pliant anchor
#

Hello everyone!
Does anyone know why when I'm generating a NavMesh, it generates an obstacle for NavMesh agents and regular Rigidbodies?
I'm on Unity v2022.2.16 & AI Navigation v1.1.3

pliant anchor
#

I figured it out, I had to modify the Object Collection settings in the NavMeshSurface component.

candid kestrel
#

Hello! A small question about NavMeshObstacles, do they affect performance of the game or does it not really matter?

left nymph
candid kestrel
#

Alright, that does actually help me though so thanks!

lament otter
#

Hey guys... Hello. I'm an animation director, ai noob and enthusiast. I was wondering these feasible methods I can apply or develop into my animation pipeline? And if so where do I get started?

https://youtu.be/wAbLsRymXe4

https://youtu.be/8oIQy6fxfCA

❤️ Check out Fully Connected by Weights & Biases: https://wandb.me/papers

📝 The paper "DeepPhase: Periodic Autoencoders for Learning Motion Phase Manifolds" is available here:
https://github.com/sebastianstarke/AI4Animation

My latest paper on simulations that look almost like reality is available for free here:
https://rdcu.be/cWPfD

Or this...

▶ Play video

With adversarial reinforcement learning, physically simulated characters can be developed that automatically synthesize lifelike and responsive behaviors.

A character is first trained to perform complex motor skills by imitating human motion data. Once the character has acquired a rich repertoire of skills, it can reuse those skills to perform...

▶ Play video
austere fox
#

The first video has links to resources in the description. AFAICT these are at research stage so I'd imagine going there would be a rocky road for an "AI noob"

autumn cliff
#

Is there a way to bake multiple navmeshes? When I'm in the Navigation window, the "Agent" tab lets me create multiple agent types, but the "Bake" tab doesn't seem to have an option for anything other than the Humanoid agents.

#

Nvm, I figured it out. I actually don't have to bake multiple meshes. I can just add a NavMesh Surface component to the terrain, and set it to my desired agent type.

wanton sand
#

Does anyone know how to remove this from the scene view?

#

Esp. when there is no navmesh present...

#

lol it's literally entirely disabled, but still showing... why????

crisp musk
#

Hi. With my new project, I now want to use runtime baking of the navmesh. However, I have an issue with it creating a hole in the navmesh surface, where my agent is currently located. The size of the hole is related to the width of the agent. During initial and offline baking, it behaves like stated in the docs, that the agent is ignored in baking. After runtime baking, it behaves as if the agent also has an obstacle component applied (which it does not), creating a hole at the agents position and auto-move it to the next spot on the rebaked navmesh.
I added two pictures, one initially baked, correctly ignoring the agents position. And one after runtime bake, ripping the hole at the agents position and auto-relocates the agent.
Any1 a hint, why this might happen to me? thx

left nymph
#

and does any of the childobject of the agent have a navmesh obstacle component?

crisp musk
left nymph
#

you could have an empty parent gameobject that has the player and the navmeshsurface as its childs

#

that way the surface wouldnt see the players geometry as a navmesh source

crisp musk
left nymph
#

no i meant all the tiles are the child of a "TileMap" Object which has the navmesh surface on it. that TileMap Object and the player could then be children of an empty "Level" object or sth. but if the player needs to be parented to a tile that wont work

#

you can put the player on a layer you exclude from baking

#

then it wont matter even if it is in the child hierarchy

crisp musk
#

Then probably the latter one, cos parenting is for moving with the platforms as they are mobile.

#

Will try that when back at desk. Thx

left nymph
#

@crisp musk just as general advice i would avoid using the hierarchy for gameplay purposes too much. for moving the player with the platform id register the player to a tile in my own datastructure and whenever i move a tile move all registered players with it myself instead of relying on parenting. just because of issues like the one you ran into where parenting is used to author prefabs in a certain way that is broken when used at runtime

crisp musk
# left nymph <@640857223890862082> just as general advice i would avoid using the hierarchy ...

Thanks for the insights into your approach, parenting as gameplay helper smelled for me too. However and sadly, all different tutorials I found for my use case use parenting, that is why I got stuck with it in first place. But my issue shows, that I have to dig into it more. I should store a ref to the tile I touch (raycast) and register to changes there. That extra mile in work will payoff, and is much less fragile prolly.

left nymph
crisp musk
left nymph
crisp musk
#

With having the agent on a different layer and exclude, the problem is gone as expected. Anyhow, with the moving platforms, the agents gets pushed to the surface edge before moving along with it. Seems like this is natural for unity's navmesh thingy, as not fully supported for moving along with things 😦

left nymph
# crisp musk Sure enough

Collect object could be set to Children instead of all if all tiles are a child of the object with the navmesh surface component

#

then you dont need to exclude player with the layer

left nymph
#

youll need to translate the agent yourself by the same amount the tile is moved.

crisp musk
left nymph
# crisp musk Right, which in fact is also always with limits. If using Warp() or SetDestinati...

oh i see but moving platforms will invalidate paths / the existing navmesh anyways. what you could do is get the path corners and save them as coordinates relative to the tile. then when a tile moves just let the agent continue on his partial path on that moving tile (just use setdestination on the last corner that is on that tile each frame while the tile is moving) and then once he leaves the tile recalculate the full path.

raw vector
#

Hello guys Im a 4th year Computer Science student and im doing a bachelors degree in AI training in Unity, im looking for a mentor that could maybe guide me through some harder choices and matters(im doing it in unity ML-agents package), if anyone is willing to help out, I would be more than grateful, please reach out to me! Cheers

left nymph