#🤖┃ai-navigation

1 messages · Page 4 of 1

sullen mango
#

At runtime you would need it to be dynamic so that you can update the navmesh https://www.youtube.com/watch?v=mV-Uh_FEBn4 is an example to it (didn't watch it all)

0:00 Intro
0:10 Awkwardly install the package
0:54 Add 2 cubes to test NavMeshes
1:20 Copy runtime baking code
2:00 Attach script to an object
2:43 Add NavMeshSurface components
2:58 Set up Navigation Baker script
3:19 Fix RunTimeNavMeshBuilder: Source mesh Combined Mesh (root: scene) 2 does not allow read access.
3:55 Does it work in Update() t...

▶ Play video
lucid elk
#

@sullen mangoI don't think that will work, it takes 10 minutes to bake the entire world

#

The only thing I can think of, if it is technically possible, is to prebake a navmesh inside my building separately, when placed onto the world, somehow connect it to the open world navmesh with a link, if that is possible at runtime?

sullen mango
radiant palm
#

Assign the generated buildings to a custom layer “NavMeshGenerate”. Change the navmesh surface so it only bakes navmeshes for the layer “NavMeshGenerate”. Bake the surface via script every time u want to rebake it

lucid elk
#

@radiant palmOkay but how to connect the navmesh inside the placed building to the open world navmesh on runtime where the door is?

#

The navmesh link

radiant palm
#

should be some tutorials on implementing them on youtube

lucid elk
#

Not that I can find

lucid ermine
#

has anyone used unity's ML agents?

#

I got it working with one agent, but now I want to do multi agent RL

#

but I can't find much about it online

lucid elk
#

Why are some sinking halfway into the navmesh?

cursive brook
#

Hello! I've been not seeing navmesh since, I believe when I updated from 2021 to 2022. It's quite annoying and it would be very nice to see it again. I've got both URP assets in Graphics and Quality settings set to none. I'm also on Linux, if it matters. I've found nothing helpful on Google so far. I've tried selecting the object that NavMeshSurface is on - nothing, I've tried opening both the old and new Navigation tab, but still nothing. If anyone has any ideas, please do tell me.

lucid elk
#

@cursive brook

cursive brook
cursive brook
lucid elk
#

@cursive brookRight corner in scene window

cursive brook
lucid elk
#

That should be in the top right corner?

#

Bottom right corner

cursive brook
lucid elk
cursive brook
#

Wait, what?

#

I just

#

switched my screen to discord and back and suddenly, it appeared

#

Interesting

#

@lucid elk Thanks tho, it's showing now!

#

Still trying to understand how I got it to appear tho. I'll be looking for that

#

Found it

acoustic gazelle
#

Anyone in here decent at working with A* pathfinding project (asset)? I'll gladly **pay **for your time to get it setup properly, and learn a thing or two along the way.
I believe it is the NodeLink2 I need working, but I have no clue how that functions what so ever 🤔

Basically I need the NPC's being able to understand portals and walk through them like a player does it.

frail lagoon
#

I'm making a top down game in 2d. I want to make it so once my player gets within a certain range, the enemies will follow the player. However I'll need to do this through path finding. What is thes best way to go around this?

lucid elk
#

@frail lagoonYou have obstacles between player and enemies?

lucid elk
#

@frail lagoonI mean, it depends how advanced your game is, if you have colliders between player and enemy and the enemy needs to move around them, obstacles like rocks. Or if the enemy should just run straight towards the player

#

If you have no obstacles just use Vector2.MoveTowards

#

And Physics2D.OverlapCircle to detect

#

If you need to navigate around obstacles I think you need a* pathfinding package

frail lagoon
#

I have rocks and stuff, I need to use the path finding. Do you know where to find the package?

lucid elk
frail lagoon
cold pulsar
#

i downloaded 2021 version of unity and i got this errors

rare lark
cold pulsar
#

I was working with 2022 version

#

And I got

rare lark
#

You downgraded?

#

That shouldn't be possible

cold pulsar
rare lark
#

In an existing project?

cold pulsar
#

I changed 2022 to 2021

#

In my project

rare lark
#

But that should not be possible because Unity explicitly says during updating your project that it cannot be downgraded to previous versions

cold pulsar
#

I got Gradle build error on 2022

#

And I was working on a mobile game

rare lark
#

What's Gradle build error?

cold pulsar
rare lark
severe fable
lucid elk
#

@severe fableI only have two animations from an animation pack

severe fable
fervent arch
#

Hey does anyone know how I can bake my NavMeshSurface while the game is running?

primal moss
dusky thistle
#

I am not sure exactly how to do this. Currently my NPC walks to a random point in my navmesh and thne it instantly starts walking right after it reaches the destination.

I want my NPC to walk to the random point, then I want it to wait a few seconds before starting to walk to another point. (Also play the walking animation)
Then I want the NPC to stand still and look at the player if the player is in close proximity to it. (the NPC will then play the salute animation only once when its close to the player)

#

This is the code for the random movement :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI; //important

//if you use this code you are contractually obligated to like the YT video
public class NPCBaseRandomMovement : MonoBehaviour //don't forget to change the script name if you haven't
{
    public NavMeshAgent agent;
    public float range; //radius of sphere

    public Transform centrePoint; //centre of the area the agent wants to move around in
    //instead of centrePoint you can set it as the transform of the agent if you don't care about a specific area

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


    void Update()
    {
        if (agent.remainingDistance <= agent.stoppingDistance) //done with path
        {
            Vector3 point;
            if (RandomPoint(centrePoint.position, range, out point)) //pass in our centre point and radius of area
            {
                Debug.DrawRay(point, Vector3.up, Color.blue, 1.0f); //so you can see with gizmos
                agent.SetDestination(point);
            }
        }

    }
    bool RandomPoint(Vector3 center, float range, out Vector3 result)
    {

        Vector3 randomPoint = center + Random.insideUnitSphere * range; //random point in a sphere 
        NavMeshHit hit;
        if (NavMesh.SamplePosition(randomPoint, out hit, 1.0f, NavMesh.AllAreas)) //documentation: https://docs.unity3d.com/ScriptReference/AI.NavMesh.SamplePosition.html
        {
            //the 1.0f is the max distance from the random point to a point on the navmesh, might want to increase if range is big
            //or add a for loop like in the documentation
            result = hit.position;
            return true;
        }

        result = Vector3.zero;
        return false;
    }


}

dusky thistle
#

please do ping me if you reply!

frail lagoon
#

I have the NavMeshPlus installed and I have this blue area outside of the mesh, any idea how to get rid of it, thanks

tall nymph
#

Hi, anyone know how to set this values from c# code before using NavMeshSurface.BuildNavMesh();? I tried to use the NavMeshBuildSettings but nothing changed. Thank you.

    `    int bs = NavMesh.GetSettingsCount();

        for (int i = 0; i <= bs; ++i)
        {

            NavMeshBuildSettings buildSet = NavMesh.GetSettingsByID(i);
            buildSet.agentHeight = 10.0f;
            buildSet.agentSlope = 10.0f;
        }`
unborn galleon
#

Is there a way to go backwards on autogenerated navmesh links? I want the unit to be able to climb up instead of drop down. I only see setting to bake dropping but none for climbing. And unfortunately, When you adjust the step height, it does not create offmesh links but instead creates a angled walkable area where the character just walks diagonally up a straight wall.

raw night
#

yo, so I created a simple enemy ai that finds the players in the scene I am using FindGameObjectsWithTag() but this seams slow would there be a quicker way to do this? Say if I have 100 players then I would not want the ai to find all 100 players but only the ones close to it.

primal moss
raw night
#

Well I will do this after I figure out why unity keeps crashing now XD, one thing at a time.

primal moss
thorny bridge
#

Heyy, i have a problem that doesn't make any sense and i've been stuck for so long now. Basically i just want to make an AI agent move from one wall to another using offmesh links, for testing purposes i set the autoTraverseOffmeshLink to false and i tell the agent only to move when he is not on offmesh links (see screenshot). But then when i run the game for some reason the agent behaves like expected when moving up the wall, but when coming back even though all offmesh navigation is set to false it still moves the agent in a random cardinal direction (see video)

rain vapor
#

I am getting what I find an unexpected behaviour using NavMeshObstacle component. I tried using it since normal baking of NavMesh will make flat areas on top of e.g. large buildings walkable and I do not want that. I just want to mark certain items not walkable solid. But adding NavMeshObstacle and then baking the NavMesh just completely removes any non walkable area and leaves the items passable by everything. Any one knows what I am getting wrong here?

kind lake
#

is there any way to stop my agent from doing this when it is at a stop?

thorny bridge
kind lake
grizzled tapir
#

My guess is its trying to go to an exact location but its missing it by a little bit evreytime

kind lake
#

my stop distance is currently the same distance as my speed(and i have tried having it higher as well)\

grizzled tapir
#

Fyi stopping distance has nothing to do with speed. It makes it if the agents distance from its destination is less then x it will stop moving

#

You got any physics or root motion animations?

kind lake
#

I'm aware. No physics or rigidbodies, no animations at all it's a pretty barebones project at the moment

fallow tulip
#

So one of the things I want to implement is a sort of environment memory where an agent can "remember" the environment in the state that it was in when the agent passed through. Pretty much a fog of war type system for the AI. Is it possible to have the AI Navigation give the agent a false path?

For example, the agent goes through a corridor with an opened security door and a while later the agent makes the decision to go back through that corridor. The path would be the most efficient path if the door were open, but some time after passing through, the door was closed by a player. I want the Agent to attempt to take that path since it thinks it is still available even though in reality these is an obstacle now. Once the Agent reaches the closed door it would then try another route if it knows of one.

Is this something I could support with the existing AI Navigation package? Or would this be something where I'd have to develop my own pathing algorithms?

jaunty raft
#

Also mind that the validity of a path is a matter of interpretation in a context. So you don’t need to invent your own pathfinder algorithm.

fallow tulip
jaunty raft
#

it can take you fairly far, especially if performance is a concern, but ofc it also has an intended use case, so you might find it (and virtually all other standard solutions) hard to use it if you need to use cutting edge pathfinding algorithms, especially for agents that have a minimum turning radius or those that aren't fundamentally cylindrical in shape.

fallow tulip
#

Awesome, thanks!

languid oracle
#

Hi, i am making a simple 2d game with top down perspective. I added A* pathfinding to my project for enemy movement and i am facing a slight problem. When my enemies have a box collider (which in my case is preferable), they tend to get stuck on other colliders with straights sides / jagged edges. I posted an image of what is happening. One solution i found was to just use circle colliders on all obstacles, but i am curious if there is a better solution for this problem.

#

Also one other related question: If i am using the default pathfinder script, can i still somehow apply force to enemies for weapon knockback? When i try to apply force, nothing happens. I guess that is because the pathfinder script is fully controlling the velocity of the object.

lost aspen
#

I baked a NavMeshSurface and the movement works fine on the editor

#

But when I build to android or any other platform, it tries to take a straight path and fails

#

I implemented the movement in ECS, is that the reason?

#

The surface object is an entity

lost aspen
#

okay seems to be related to ecs

wild kraken
#

Hi guys, i could need some input for my case. I simply work with multiple agents i have "selected" and want to send them to a specific point. Obviously only 1 agent can stand exactly on the point where the mouse clicked and the other have to gather around. What is here the best approach? i have tried some ideas i had for example playing with the stopping distance but i just dont find anything on the internet which is weird because isnt that a common problem when working with multiple agents? I dont want any Code, i am just curious how you solved this "problem" in your projects. Thanks for any answers!

tardy junco
# wild kraken Hi guys, i could need some input for my case. I simply work with multiple agents...

There are many approaches to this. You're basically dealing with unit formations. You could define the formation programmatically, for example placing the units on a circle circumference around the target point, or provide some predefined formation and calculate each position in formation relative to the target point.
You can also make your agents use some kind of steering behaviour and adjust their target destination themselves. For example, make them all go to the same destination, but also keep some distance away from other agents.

#

You can also combine both of the approaches.

stiff kite
#

Anyone know how to fix these I tried everything

radiant palm
#

Elaborate

glossy sundial
#

I am looking for resources on the new Muse Behavior.

I have the 1 Youtube tutorial and I have the 1 project.

Are there any other docs and links I am missing ?

This is what I have

https://assetstore.unity.com/packages/templates/tutorials/muse-behavior-tutorial-project-269570

https://docs.unity3d.com/Packages/com.unity.muse.behavior@0.5/manual/index.html

Use Muse Behavior Tutorial Project from Unity Technologies to elevate your next project. Find this & more Tutorials and templates on the Unity Asset Store.

sharp wren
#

How you program your AI on a multiplayer game? Im trying my best but I can only make the AI follow the host...

#

Using NGO

vocal crescent
#

Hi, just started with Navmesh and my capsule is not moving. How can I fix that and how does that happen?

using UnityEngine;
using UnityEngine.AI;
public class playernavmesh : MonoBehaviour
{
    [SerializeField] private Transform movePositionTransform;
    private NavMeshAgent navMeshAgent;

    private void Awake()
{
    navMeshAgent = GetComponent<NavMeshAgent>();

    navMeshAgent.enabled = true; // Aktiviere den NavMeshAgent
    navMeshAgent.speed = 5.0f;
}
    private void Update()
    {
        navMeshAgent.destination = movePositionTransform.position;
    }
}
raven rapids
#

whenever it takes more than one frame to calculate a path

#

so I'd try setting the desitnation once in Start

vocal crescent
#

I will try, thanks!

#
  • Sadly doesn`t work either
gloomy holly
#

how can I prevent the navmesh on one additive scene to effect the agents on another scene?

#

despite them being in the same place

raven rapids
vocal crescent
raven rapids
raven rapids
vocal crescent
#

🇦🇸

vocal crescent
raven rapids
#

Make sure you have no warnings in the console about an agent not being on a path

raven rapids
vocal crescent
raven rapids
#

can you show me the inspector for the object with the NavMeshAgent on it?

#

(and have you tried only setting the destination once?)

vocal crescent
raven rapids
#

Isn't the capsuel already at the destination?

#

You have the wrong transform!

vocal crescent
#

im stupid

raven rapids
#

haha, no problem

vocal crescent
#

works now 🙂 thank you

stiff kite
#

It's just been there and idk how to fix in and outside unity

zealous gate
#

Hello.
I fail to understand the criterias for NavMeshAgent.SetDestination(Vector3 destination) to return true or false.

In my scene shown in the picture, the NavMeshAgent held by the Player gameobject returns true when I set the destination to the Tree 1) but returns false when I set the destination to the Tree 2). I do not understand what differentiates them.
Is there some documentation that goes into details about what is a valid destination vs what is not ? Any idea regarding the specific example in the screenshot?

Any help would be much appreciated.

raven rapids
#

Returning true does not mean that it found a path

#

It just means that the request itself was successful

#

I'm guessing that it does some kind of heuristic to decide if the navigation is possible

#

if it sees that point 2 isn't even close to the mesh, it could immediately bail out

#

notably, if you ask to move to a disconnected region, it's going to have to spend some time to look all over for a path (including NavMeshLinks)

raven rapids
#

er, OffMeshLink, not NavMeshLink

zealous gate
#

For all the usecases where it returns true, it was able to compute a Partial or Complete path and move to the destination or closest edge

#

For the Tree 2) where it returns false, hasPath stays false, and the agent never moves

raven rapids
#

It might be just too far away from any valid point on the mesh to get a partial path.

#

Although I would expect it to at least get a partial path there.

zealous gate
raven rapids
#

I'm not familiar

#

A stopgap would be to use NavMesh.SamplePosition to snap to a valid nav mesh point

#

You can control how far that searches.

zealous gate
#

The issue with SamplePosition is that it could potentially return the furthest valid position from the player on the edge of the tree carved area

raven rapids
#

well, consider that, if navigation did succeed when trying to move to the tree, it would have the same outcome

#

it'd move you as close as possible to the point, right?

#

if SamplePosition takes you to the far side of the tree, then a successful SetDestination would have done that too

zealous gate
#

that's true

raven rapids
#

You could fiddle with that by sampling positions a little closer to the player first

zealous gate
#

yeah but closer to the player is not trivial

#

there are edge cases where offsetting the destination towards the player before sampling would result in a sample further away in terms of path to reach it

#

this would be such a case :

livid bay
raven rapids
#

Okay, so you've hit Bake and you aren't seeing any surfaces in the scene view

livid bay
#

yea

raven rapids
#

Do you have gizmos enabled in the scene view?

livid bay
#

how can i check it

#

im also pretty new

#

so yea

raven rapids
#

It's this sphere in the top right corner of the scene view

livid bay
#

oh man

raven rapids
#

You can click that to toggle gizmos on and off

livid bay
#

its like

#

over the map

raven rapids
#

Do you have a plane up there you're using to create a ceiling or sky?

#

The default settings for the NavMeshSurface are very aggressive. They look for every object in the scene on any layer

#

And they look for renderers, instead of using physics colliders

#

I would suggest changing the settings.

#

Here is how I like to do things.

#

I switched "Use Geometry" to Physics Colliders, so that it only looks for colliders

livid bay
#

okay

#

so i think it works

raven rapids
#

looking for renderers is fiddly

#

"Collect Objects" is set to Current Object Hierarchy. This way, only children of the NavMeshSurface are included in it.

#

So you won't get huge swaths of navmesh for areas that aren't even meant to be reachable (like a big mountain in the distance)

#

and "Include Layers" has been set to only care about the "Map" layer

#

(that's not a default layer; I added it)

#

this way, I won't accidentally create a surface on anything that isn't meant to be the map itself

raven rapids
livid bay
#

yea

#

but the monster isnt moving

raven rapids
#

well, now you'll need to give it a NavMeshAgent component and tell that component where to go

livid bay
#

can you help me with that?

#

so i asked chat gpt and everything is working

#

thanks for help!

raven rapids
#

i would suggest having a look at the manual

sterile dagger
#

ive been using chatgpt to write code to test its capabilities (not because im trash at coding) and ive been wondering if navmesh affects a game object deletion. i have it to where when a navmesh ai touches another certain navmesh ai its supposed to delete that ai but it doesnt i can share the scripts if u need

languid oracle
lucid elk
#

Does anyone know how to make agents use the full width of a navmesh road, and not the exact shortest route? Imagine pedestrians walking on a sidewalk, not everyone of them cuts the corner perfectly and not all of them walk in a straight line hugging the building wall. I want to spread them out a bit. Also how would you solve them walking on the right vs left side?

jaunty raft
#

Unfortunately nav meshes are very bad at representing uneven path costs, which could otherwise be used to make the pathfinder respond to stuff like sidewalks or congestion.

livid vector
#

I want to create an enemy Ai but for that should I fire the raycasts from the player or from the enemy?

#

I’ve done the patrol state now I want to create the follow state

livid vector
livid vector
#

okay so I will use from the enemy than thankyou

hard sundial
#

how do i fix navmesh being slippery

#

he is fast

#

and when he tries to stop he cant

#

he just slides

hard sundial
#

this chat is so dead

raven rapids
#

increase your nav mesh agent's acceleration

#

the mesh itself has no bearing on how the agent moves

#

it's just a collection of walkable areas

brisk pumice
#

do any experts here possibly know the cause of this?

#

It's always worked fine in the unity editor

#

but building and running a development build yielded this result...... it also lagged a lot, but it eventually worked

#

Ran it a few more times, and I'm unable to reproduce

#

unfortunately i want more information but if it don't reproduce it's hard to get that

tardy junco
#

Floating point error/timing. Many reasons. You should always make sure your agents are on the navmesh before assigning destination.@brisk pumice

charred bobcat
#

Why can't my character go up the stairs? how can I change the slope grade?

tardy junco
charred bobcat
tight kettle
#

how would yall code in those big worm boss enemies in games?
Like the head is just a flying thing that has slow turn radius, but what should the segments do?

Right now I’m making the ith segment follow the (i-1)th segment but the tail isn’t follow the exact path that the head took. And the segment are kept in distance with a simple if(distance < segment lengt) then don’t then move, but that’s making the whole thing a little jittery…

#

Like Terraria/Risk of rain 2 worm

tardy junco
tight kettle
tardy junco
#

Yes. Unless you cache the last frame positions of each part and use that. In this case the order wouldn't matter.

tight kettle
#

Did not work. I might go with some kind of record positions + spline approch type deal

fringe crag
#

I'm trying to do a very very simple Navmesh.raycast on my terrain but it literally never hits. I'm using the AI Navigation experimental package for component based navmesh and no luck. I've noticed some other things not working as well. Anyone have any insights??

fringe crag
#

some further investigation. It seems like it is hitting because they NavMeshHit.position does end up setting to the correct location but NavMeshHit.hit always returns false regardless of whether it hits or not

tardy junco
fringe crag
fringe crag
#

2021.something

tardy junco
#

I don't think there are any major breaking changes between 2019 and 2022~3

#

You could at least try and if there are problems, roll back.

jaunty onyx
#

Someone knows why this isn't blue? (I followed a tutorial step by step and it's set to walkable)

rustic obsidian
#

Pick one channel to post in next time.

stiff kite
#

What do I put in player transform

tardy junco
stiff kite
#

Nvm i figured it out it was simple

viral owl
#

Question, the stairs are not width enought to have a navmesh, but I still want to allow character to walk throught it. What can I do? Putting a mesh link doesn't seems to work. Is there a way to force it have a nav mesh or something?

timid grail
#

Hi
i have tried to find a example online for my specific usage but i cannot
i want to have my navmesh agent follow me the player but the issue is that
it is for an android device aswell as the fact that the mesh for the world isnt generated before hand... I am using the Quest 3 vr which scans the room and i want to do an xr app where something follows me but i can not seem to figure out how o get it to get the newly scanned rooms mesh and apply it as the surface for it work

not sure if i explained that well also not sure if i should post this here or #🤯┃augmented-reality or even #🥽┃virtual-reality ... Not sure so sorry if wrong place

thorn otter
#

So I'm making an AI enemy, I gave it a baked navigation but for some reason it ignores doors and tables and walks right through them even if they have colliders. How do I prevent them from walking through the door? Also, If I'm missing any information, please tell me and not not ignore.

pine locust
#

Make sure they have colliders and retake the nav mesh

#

Or

#

Move the objects off the blue part

grizzled tapir
#

Any good way to make a ai agnet, STRAFE(walk to the left and right) so it gains sight of a game object?
The only thing i dont know how to do is the algorithm that will gave me a position to set the agents destination to.

thorn otter
pine locust
#

They don’t need to float

thorn otter
radiant palm
#

Add navmesh obstacle component

#

Turn on carve

#

Should solve issue

thorn otter
#

Alright lemme try.

radiant palm
thorn otter
#

This good?

#

And do I have to re-bake the navigation?

radiant palm
#

Think it updates run time

#

Hopefully it’s carved an area around it

thorn otter
#

How do I check?

radiant palm
#

Like in that image

thorn otter
#

I think I have to resize it.

radiant palm
radiant palm
thorn otter
#

Ok gimme a sec

#

I resized it, I'm going to test it now.

#

And I can add it to other moving objects like if I'm holding a crate?

radiant palm
thorn otter
#

Alr thx

native dome
#

Why does Unity returns 0 corners when attempting to calculate a path anywhere beyond the orange Area? Using a simple box collider to generate the Navmesh which is generating correctly. Input data is not an issue due to a visual indicator confirming its validity.

#

Is there not any way to actually debug Unity's pathfinding logic and why it fails without a source license?

lone tundra
native dome
#

Okay, something slightly promising, in the editor when the NavMesh agent is select it's seems to indicate some sort of region by darkening the area around them. The NavMesh region correctly transitions when moving between spaces inside of the orange lines, but fails to move overwhen moving outside of the orange lines.

native dome
noble fog
atomic rune
#

I get ```Library\PackageCache\com.unity.ai.navigation@1.1.5\Editor\Updater\NavMeshUpdaterUtility.cs(52,60): error CS0117: 'CollectObjects' does not contain a definition for 'MarkedWithModifier'

#

I'm using version 2022.3.11f1

molten sequoia
brisk pumice
#

is there a reason why navmeshes are super intensive when baked

#

like even if the area isnt even that big

#

i click bake and i hear my fans spinning up

molten sequoia
# brisk pumice i click bake and i hear my fans spinning up

It will most likely try to utilize as much hardware as possible to get the calculation done as fast as possible, so your CPU will end up working as hard as possible to meet that demand. CPUs are designed to work at 100% generally speaking, so I wouldn't worry about it.

atomic rune
urban crescent
lusty cosmos
#

anyone have any useful resources for advanced enemy ai that react to player states
i have not really touched upon this area before

jaunty raft
lusty cosmos
#

cover usage

#

multiple platforms

#

floating in between

#

my AI are pratically drones

#

and im tryna learn the best approach to navigating them around levels and floors in reaction to states

#

just any form of learning material to put me on a correct path would be amazing

jaunty raft
# lusty cosmos just any form of learning material to put me on a correct path would be amazing

you can start looking here, if only to get to know the right keywords, public resources on the internet are quite old (although not outdated, this is all deep/foundational stuff thats timeless): http://www.gameaipro.com/. More recent resources are mostly conference talks, some dev-logs you have to search for, but for those to be come useful you need the foundations of a intro to algorithms, complexity and some of the ideas in the books above. Not much innovation has happened in the field in the past 10-15 years. It's all just NavMesh, BehaviourTrees, Utility Functions, State Machines, some form of action planner (if even) and a lot of A*.

late raptor
#

What is the NavMesh.SamplePosition equivalent for NavMeshSurface?
I can't find Scripting API for NavMeshSurface in documentation, only the regular NavMesh. And unfortunately NavMeshAgent.SamplePathPosition is different. I can't find the closest available walkable position from a certain position.

raven rapids
#

The only difference is that it can now take a NavMeshQueryFilter instead of an areaMask

#

Not all of the navigation-related stuff got pulled out into the AI Navigation package. NavMesh is one of them that remained.

#

(in fact, as far as I can tell, nothing got "pulled out")

#

it's just that new stuff was created in the package, like NavMeshSurface

late raptor
# raven rapids You still use that method.

I'm not sure what you meant.
I have multiple navmesh surface in one scene, they have different navmesh data.

However using Navmesh.SamplePosition, I cannot select which navmesh data I wanted to use.

raven rapids
#

You don't select a specific nav mesh surface

#

NavMeshSurface is just used to define how to bake navmesh data

#

I don't believe that you can find out which surface is responsible for a specific bit of navmesh

late raptor
#

Hmm yes, maybe not navmesh surface, what do you call the data being baked? Those, i have multiple of them.

How do I get Navmesh.SamplePosition using one of those specific baked things?

raven rapids
#

I'm not aware of a way to do that.

lusty cosmos
#

Is it possible for AI to predict the movement of a Character Controller

#

without a rigidbody

zealous mantle
#

Sure, make the velocity of your code available to the AI to determine where it might be next frame.

lusty cosmos
hollow oasis
#

does AI navigation menu not exist anymore

#

how do i bake navmesh

#

i use 2022.3

severe fable
raven rapids
#

I've been fussing over how, exactly, to design my enemy AI for a while now.

#

I'm building a game that's a lot like Alien: Isolation

#

So there's one big threatening enemy that I'm spending a lot of time and effort on

#

I'm currently using something that's basically just utility AI -- i make up a list of possible actions and pick the best one. This is okay, but I'm having trouble expressing anything more complex than immediately performing an action

#

if the enemy has to grab the player before it can kill them, and the enemy's goal is to kill the player, I need a way to express that grabbing the player will help the enemy achieve its goal

#

obviously this is where you bring up goal-oriented action planning

#

and I think that's where I want to end up going?

#

The roadblock, for me, is figuring out how to turn my game's state into something that a GOAP planner could actually work with

#

I guess I just don't know where to start with that. All of the example implementations I've seen use really primitive state information

#

https://drive.google.com/file/d/0B3-H32fPH4lgcWl1alc3cWpZaVk/view?resourcekey=0-wsaTAaiNAi9yUpeBd0BFIQ

Representing every aspect of the world in this way would be an overwhelming and impractical task, but this is unnecessary. We only need to represent the minimal set of properties of the world state that are relevant to the goal that the planner is trying to satisfy. If the planner is trying to satisfy the KillEnemy goal, it does not need to know the shooter’s health, current location, or anything else. The planner does not even need to know whom the shooter is trying to kill! It just needs to find a sequence of actions that will lead to this shooter’s target getting killed, whomever that target may be.

this idea in particular is giving me trouble

#

man this is a nebulous question

#

I currently have "Activities", which would be "Grab Entity" and "Attack Grabbed Entity" in this example

#

I should probably just call these "Actions", but I don't like how that clashes with System.Action 😅

#

Given a sequence of activities, I can already make an NPC perform the activities

#

that part is fine

#

It's the conversion from "concrete things you can do in the game" to "abstract actions the planner deals with" that's messing with me.

#

I guess the process would be something like:

  • Pick a goal
  • Figure out a list of actual activities the entity can perform
  • Transform these into planner actions
    • Activities are annotated with pre and post conditions, like...
      • Pre-condition: "Target must be in a normal state"
      • Post-condition: "Target is grabbed"
  • Solve for a sequence of actions that winds up satisfying the goal
  • Queue up the activities that those actions came from
#

But I've also got this nagging thought that GOAP is too much of a long-term planning tool for this kind of rapid decision making.

I'd be happy if I could just make it so that, if the enemy wants to kill the player, the enemy understands that grabbing the player is a good thing to do

#

even if the enemy would have zero other reason to grab the player

raven rapids
#

one thing I've considered is allowing each activity to suggest a "replacement" if the activity is not currently possible. This would require me to explicitly set up replacements (kill player -> grab player -> approach player), so I wouldn't have the real flexibility of GOAP, but it'd be a decent approximation

raven rapids
#

I'm worried that I'm going to create way too much garbage as I do A*, but...we will see!

raven rapids
#

oh. that was easy.

#

it turns out I had the completely wrong mental model (I wasn't doing A* at all in my head)

#

i was imagining some kind of depth-first search

jaunty raft
#

They are very exciting ideas though and I’d love to see a game actually use them to create an interesting experience.

raven rapids
#

TAP?

jaunty raft
#

You might get a lot of mileage from clever use of reflex actions (response is hard-wired to a sensor) and flat utility functions (action is driven by multiple sensors but ‚planning‘ is approximated by a heuristic) that don’t really do complex planning but operate similar to an insect colony where various reflexes act as controls for each other

jaunty raft
raven rapids
#

(also brb, food)

drifting valve
#

been scratching my head for a while now, why does baking with only ground layer included also include the obstacle cube I've made?

vale grail
#

how do i make the entire floor walkable? the tighter spots it wont bake even with 0.01 as the radius

raven rapids
#

Can’t see anything. Show this with the unlit view mode

#

Also, show us your nav mesh surface settings and the relevant hierarchy

raven rapids
#

continuing from #💻┃code-beginner -- I guess I shouldn't say F.E.A.R. faked all group activities. It just implied more than it actually did by spamming voice lines at you :p

#

Also, I missed one important PDF

#

the one I was looking for talked about how F.E.A.R. improved upon NOLF 2's AI

fathom arch
#

I'm actually totally unfamiliar with NOLF 2 so I'll give that a look

#

I'm somewhat aware of how FEAR does things, it seems to be the main reference game when people talk about GOAP

raven rapids
#

yeah

fathom arch
#

I'm aiming for some actually intelligent group behaviours though, not sure if I can fake it all

raven rapids
#

There it is

#

Now let’s look at our complex behaviors. The truth is, we actually did not have any complex squad behaviors at all in F.E.A.R.

#

But I guess that's the whole point :p

#

there are squad behaviors that try to create plans for multiple agents at once

fathom arch
#

Does FEAR have NPC's other than enemies?

#

Like do they ever fight anything but the player

raven rapids
#

I don't think so

#

I played most of F.E.A.R. 1

#

Group combat gets really exciting

#

I'm making AI for an Alien: Isolation style of game

fathom arch
raven rapids
#

but it is designed to have arbitrary numbers of entities from different factions

#

I realized I need to retool my AI when I found out that the enemy wanted to walk to the player more than the enemy wanted to hurt the player

#

so it'd just..run up to you and stare at you

#

I could keep turning the weight down on the "chase enemy" state, but I hate that kind of tuning

#

if the weights are just there to sort the states, they're not really weights

fathom arch
#

Yeah, GOAP sounds good for this

raven rapids
#

speaking of, oh boy, that's the next thing I need to do: incorporate weights into each action

#

It's hard to choose the right A* heuristic

#

If your heuristic overestimates the cost to reach the goal, A* can produce suboptimal paths

fathom arch
#

Does it use some kind of pathfinding algorithm from the Goal, through the available actions towards the current state?

raven rapids
#

Right.

#

A* is happening around lines 60 - 100

#

it might be mildly wrong

#

i should check that it's actually..correct

#

The general idea is that I have a list of possible actions

#

Actions can check if they satisfy an outstanding desire of the current planner state

#

e.g. the planner state wants "Foo" to be true

#

and "Foo" isn't true

#

these relevant actions are used to produce new planner states

fathom arch
#

Does it handle cases where a chain of multiple actions can lead to the goal?

#

I suppose it does

raven rapids
#

Right, that's the big idea

fathom arch
#

Right

raven rapids
#
     foreach (var action in state.SuggestActions())
            yield return action;

oops, that doesn't test if the action is actually useful...

#

no wonder it was running forever

#

it was inventing massive chains of actions that all moved to the same spot

#

One thing that this does not handle is "removing" facts

#

notably, if action A moves to a position and action B moves to another, this won't make us lose action A's position

#

I just implemented this over the past two days so I'll need some time to experiment, haha

#

Most GOAP plans are actually really short, though

#

like, just a few actions

#

That GDC talk I linked talks about some real-world implementations and gives some statistics from them

fathom arch
# raven rapids like, just a few actions

Yeah, but even something like grabbing a nearby ranged weapon and then attacking the player with that, instead of just using its current melee weapon, will make it seem so much more intelligent

raven rapids
#

Yep!

#

some decision-making will still live outside of the planner

#

in fact, the GDC talk suggests pushing a lot out of the planner

#

in Shadow of Mordor, enemies can go into an "investigating" state when they find a dead body

#

iirc this doesn't really use the planner at all

fathom arch
#

I'm probably going to end up with some hybrid amalgamation

raven rapids
#

I'm re-introducing a "random wander" behavior right now. It's not going to use the planner to decide where to go.

#

The entity will just have a low-priority goal that randomly turns itself on

#

so if the planner picks that goal (which it will trivially make a plan for), the wander behavior will scan the map for interesting places and go to one

#

The real impetus for GOAP was that the enemy has a two-step process to hurt the player : grabbing, then attacking

#

I want the enemy to only desire to attack the player

#

It shouldn't want to just..grab random entities for no reason

#

But it should figure out that it needs to grab an entity to attack it

fathom arch
#

Yeah

raven rapids
#

I was considering some less-general ways to do that

#

like having each activity suggest an activity to do first

#

I made an RTS a while ago that worked a bit like that

#

if you tried to perform an ability but you were out of range, the ability would insert a move order and then reinsert itself into the order queue

#

It worked great for that situation

fathom arch
#

That sounds plausible yeah

#

I suppose that RTS games do a lot of things I would find useful

#

But I haven't really seen much learning material from RTS developers

raven rapids
#

I completely DIY'd that game, yeah

fathom arch
#

I made a graph system for my AI but found it semi-useless since I'm really just evaluating each available state whenever making a decision

#

And it looks like... this...

#

🕸️

raven rapids
#

splat

#

oh, yes, and as I speak of the devil, Anikki was helpful to talk to :p

jaunty raft
#

you can do a bunch of what GOAP would effectively yield with variations of that (if you don't go too crazy)

#

typically the actions your ai performs in a game an be abstracted into very simple components like "move to" and "act on X when at position with Z in hand".

#

so for that you'd only need a generic behaviour tree that can solve any "go to X while having Y which you can get from Z" type of "plans"

#

this is already extremely expressive and you can build a colony sim AI with just that

raven rapids
#

Definitely -- and I will probably wind up mixing more of that in as I crash into roadblocks down the line 😅

jaunty raft
#

its the most fun part of gamedev imo

raven rapids
#

I'm interested to see how far I can get with a very loose set of goals and actions

jaunty raft
#

the worst part is debugging it though

raven rapids
#

i'm going to need a good plan visualizer

#

I'm already on like three levels of abstraction

#

the plan is made of planner actions, and planner actions resolve into brain actions (which the entity's brain actually executes)

jaunty raft
#

crazy

#

hope it works!

raven rapids
#

Fingers crossed 💥

jaunty raft
#

🤞

raven rapids
#

and if this fails I'll just make the enemy into a skibidi toilet that pathfinds directly to you and earn $50 million on Itch

jaunty raft
#

😄

raven rapids
#

now, i'm going to pathfind into the kitchen

blazing pasture
#

this sounds bizarre but i cannot find the button to bake navmesh

#

i got the ai package, but how do I bake? lol,..

raven rapids
#

The AI Navigation package introduces the NavMeshSurface component

#

You no longer bake everything from a special editor window.

glacial coyote
#

i having problem with navmesh when that ai is in attack mode and trying to chase player it seems good but when player is moving or running that ai is glitching idk why btw navmesh is on terrain so ye

fathom arch
#

If you are calling SetDestination every frame, it might get stuck on the pathPending state?

#

You could share your code - unless you already fixed the issue

glacial coyote
#

Thats it

robust sequoia
#

Hey, guys,
Who used Emerald AI (there is new version 2024), please, share your experience.
I would like to know a bit about the capabilities of the tool. I couldn't find the needed info (I probably need to go through all the documentation. I've read a brief overview). Probably, my questions will not be appropriate for such a tool, but I'm kind of a newbie in AI, and specifically for this tool.

  1. There are a couple of ways doing the AI - GOAP, Behaviours Tree, HTN, Utility AI, FSM. Which one do we have in this tool? Or we don't need them here? Or is this not an appropriate question for such a tool, and should we use any of these approaches separately from this tool?

  2. What are the limitations of this tool? Is it bound to 3D, or is it possible to use in 2D too? Maybe it is more suitable for some specific types of games?

  3. What about performance? Is it performant enough for mobile development, or is it better not to use it for mobile games?

  4. Is there such a thing as pathfinding? Or this is something we need to provide ourselves (There are plenty of good assets for this functionality).

  5. If you also have experience with version 3, I would appreciate hearing your feedback (I own Emerald 3, but never used it) - what is the biggest diff for you? What about performance in comparing?

Thank you in advance!

alpine glacier
#

I'm having a problem where my zombies don't use the links generated and just go stationery when it cant reach the player instead of using the links.

fiery crypt
#

I need help with NavMesh, ive done it in 3d, but never 2d. I have two tilemaps for the colliders and walkable area, I tried to use NavMeshPro, but no tutorials seem to work for my game.

arctic lava
fiery crypt
#

idk if i have too complex tilemap or what

fiery crypt
arctic lava
#

you can also have multiple unwalkable areas

fiery crypt
#

should i have the Navigation modifier on the grid, or one on each individual tilemap?

#

I put it on the grid

#

oh shit

#

i switched it and its working

#

thanks!

arctic lava
arctic lava
alpine glacier
#

im having an issue where this isnt moving, when i change the obstacle avoidance radius it works is there a component problem anyone sees here? maybe my collider or I need a rigidbody somewhere?

cinder hornet
alpine glacier
#

I think I fixed it I just redid the radius.

#

it was weird but it works

tender musk
#

Hey how can i make make navmesh on dynamic ground, I have a bridge that once it's walked on it falls but returns in 10 second, how can i make my agent walk on it when the bridge is available

old timber
fathom arch
#

In case anyone is interested, this guy Iain McManus makes decent content related to AI and Unity
https://www.youtube.com/@IainTheIndie/videos
Only 4k subscribers which is kinda sad. He worked on Medieval 2: Total war and Bioshock Infinite.

#

It's mostly intermediate stuff

drifting valve
#

I apologise for the absolute horror that is this screenshot, but I have a grid of maze nodes, each of them has their own little floor, I want to have an enemy be able to roam around the maze but the small Mesh surface makes it get stuck in one grid

#

essentially what im asking is how to make a navmesh surface for a grid system that gets created at runtime

raven rapids
#

one option is to just bake a navmesh at runtime

#

otherwise, you'd need to add off-mesh links between each little island

#

(and that'd be pretty awkward)

charred anvil
#

I am using a* and I was wondering where I could find good documentation about customization, any ideas?

alpine glacier
#

Anyone know why my zombie won't use offmesh links?

old timber
alpine glacier
#

But it still won't use the links

alpine glacier
#

The links are autogenerated with the surface

raven rapids
#

I'm using a NavMeshAgent to decide how to move, but I'm not having the agent move my entity directly.

#

I was setting nextPosition every frame to make sure that the simulated position of the agent matched the actual position of the entity in the world

#

However, I wound up in a weird situation: I got the agent stuck on the other side of a thin wall

#

setting nextPosition respects obstacles, so it couldn't reset the agent's position properly

#

I found the Warp() method, but this appears to completely break my movement. If I run it every frame, then the simulated agent never moves

#

I guess this is an order-of-execution problem...

#

if the agent updates before it's warped, it doesn't go anywhere

#

ah, calling Warp seems to make the agent stop

lusty cosmos
#

how would i approach AI navmesh and changing environments (aka moving platforms, floors, stairs moving, obstacles)

#

etc

lusty cosmos
proper birch
#

Anyone know how to manually pop the first path corner in NavMeshPath?

#

I am not using agents to process my movement, but I want to try follow the path my agents produced.
But it seems like NavMeshPath.corners setters are private

#

Nvm I'll just use a copy of it

#

Seems like its not meant to be used this way

honest kraken
#

My NavMesh object thing is set on Walkable, and the thingy doesn't show up
What I expect: (the image with the line going through the door)
What I got: (image without the line through the door)

honest kraken
#

I may or may not be using the obsolete Navigation tab.

marsh verge
#

anyone get NavMeshBuildSourceShape.ModifierBox to work for when NavMeshBuilder.UpdateNavMeshDataAsync? adding modifier boxes to the sources doesnt change the navmesh at all for me

uneven dagger
#

I can't seem to spawn navmeshagents properly on a rotated navmesh, how to make it work?

earnest mason
#

Anyone familiar with NavMeshPlus (maybe not specific to the package itself) able to tell me why these gaps are forming?

gloomy halo
#

hello im trying to add a nav mesh agent to a object but when i search ,it doenst appear in the component list

raven rapids
#

I forget what got moved into the AI Navigation package and what stayed in Unity’s built-in libraries

#

It looks like it should be built in

#

But you will want to install the AI Navigation package either way

minor juniper
#

why is my navmeshagent so extremely clumsy

#

hes like runing straight lines into stuff

raven rapids
#

Its acceleration is only about twice as high as its max speed, so it takes half a second to stop or start

vital bison
#

as you can see the blue gizmo follows the navmesh links but the transform is keeping the same height until the blue gizmo hits the ground

brisk delta
#

guys why navmesh does this

#

after trying goes to correct destination

#

idk how to fix this I cleared and baked with different settings still doesnt work

brisk delta
raven rapids
#

yeah, you need a relatively high acceleration

#

otherwise everyone is sliding around on ice

mighty garnet
#

does ai navmesh support moving surface in realtime?

shell umbra
#

Hi, do you know how to make trees that are included in terrain not be in ai navmesh surface?

radiant palm
#

Google can tell u more

raven rapids
#

It looks like it should be able to, but I can't make it work.

#

I wound up writing a script that makes all of the trees real (by instantiating prefabs on them) so that I can bake the nav mesh

#

then I just delete the real trees afterwards

#

you drag a terrain object into the field in the "Terrain Reifier" window and then hit "Make Trees Real"

honest kraken
#

My NavMesh will not show up.

#

It's enabled, visually.

raven rapids
#

Check that you have the "AI Navigation" overlay menu enabled, then check if it's set to actually display surfaces

#

something is going very wrong in this menu

vital bison
#

Hey guys! I just got started with navmesh links and oboy it opens so many doors for opportunities!
Im currently using it for my enemies (zombies) to jump over walls etc, but ive stumpled into a problem.
I can shoot of the legs on the zombies with makes them cribbled and I have no clue how to disable the link if the legs a blown off

#

this is my current setup and I have all the logic there, but I cant get the "linkID" until Im actually on the link

earnest mason
#

Is there a way to make this path walkable without deleting the underlying not walkable ground tiles? I'd essentially like the path to overrite the ground

#

See I am able to do it if I delete the ground tiles underneath the path itself, but I'd really like to just make paths overtop the not walkable ground instead of having to go in an delete these afterward

hot wraith
#

Does anyone know the solution to this problem?

grave venture
#

Where is the ai navigation ui?

#

This ui

#

nevermind

eternal sparrow
#

Im unable to see the navmesh surface area I believe its cuz the ai navigation window doesnt show. Any help?

#

Oh shit found it
For anyone else :
Click the "scene" tab and click "Overlay Menu" and select ai navigation :D

raven rapids
#

You can also hit ` to open a list of overlays

grave venture
#

I want the NavMesh agent in unity to stop walking once my Attack() method is called. And then after a couple of seconds, i want the AI to start walking again, at its normal walking speed. I have tried writing something but it dosent work, and i dont know why??

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public class AiLoco3 : MonoBehaviour
{
private Transform player;
private NavMeshAgent agent;
Animator animator;

public float agentSpeed = 2f;

void Start()
{
    player = GameObject.FindGameObjectWithTag("Player").transform;
    agent = GetComponent<NavMeshAgent>();
    animator = GetComponent<Animator>();
    
    agent.speed = agentSpeed;


}

void Update()
{
    agent.destination = player.position;
    animator.SetFloat("Speed", agent.velocity.magnitude);

    //Debug.Log(agent.velocity.magnitude);

}

public void Attack()
{
    Debug.Log("ATTACK");
    agent.speed = 0f;

    StartCoroutine(ResumeWalking());
}

IEnumerator ResumeWalking()
{
    yield return new WaitForSeconds(2);

    agent.speed = 2f;
}

public void Charge()
{
    Debug.Log("Run");
    agent.speed = 8f;
    Invoke("ChargeTime", 2.0f);
}
public void ChargeTime()
{
    agent.speed = agentSpeed;

}

}
The Attack Method is called from a other script, that works perfectly. Because when the Attack Method is called it does debug "ATTACK" however it does not stop walking at all, it just keeps walking, like nothing ever happend.

And i dont get any error messages.

dark willow
#

Please surround your code in three ` symbols (in american keyboards it's the symbol paired with ~ in the upper left of the keyboard)
it produces this format

public void Main() 
{
  Hello.World()
}
rustic obsidian
#

!code

pulsar waspBOT
compact veldt
#

im trying to generate navmesh surface at runtime

#

it works in editor but it wont work in build mode right?

#

how can i fix it?

lost nexus
#

The surface script:

worn oxide
#

Does anyone have any resources demonstrating how to use splines to identify walkable areas, such as sidewalks and crosswalks, for NPCs? Any thoughts on this approach?

old timber
frigid mango
#

why is my agent invisible when i start the game(no there are 0 objects on the scene except walls so there is nothing infront or behind it)

compact veldt
worn oxide
old timber
#

you define navmesh areas with different costs

tawdry vine
#

could anyone help me with my a* pathfinding, im having trouble with the grid

merry bane
#

I'm ganerating navmesh at runtime when user put a floor or wall. But it's so bad that It make it stutter, Is there any solutions on this?

#

Somthing like, only generate at certain radius on where my player at?

#

Found this, and will be trying it again.

#

Make it relatively small, but still it's really heavy.

old timber
deep otter
#

should be on the unity forums

hexed wedge
#

Lol

old timber
fair pebble
#

I'm having this issue with agents getting stuck on navmesh vertexes? It seems like they enter the higher cost area, try to move out of it, and then walk back into it. Is there a way to prevent this behaviour?

fair pebble
#

I'm currently running in 2022.3.12f1. Did the NavMesh and other relevant components get substantial updates over later versions?

raven rapids
#

AI Navigation did get a 2.0 version in 2023.2.x

#

I haven't really looked at what changed, though

glacial shadow
#

@raven rapids hi

#

can u help me with unity

#

i dont know how to upload a package

alpine glacier
#

I have a question about the navigation

#

So when i go to the Window tab and AI, I only see Navigation and NavMesh Updater and that's in version 2023.2.17f1, i only need the baking part but i can't find it

alpine glacier
#

@everyone?

noble fog
#

@alpine glacier Instead of trying to break #📖┃code-of-conduct ask a better researched question and meanwhile try tind the answer yourself.

autumn patrol
serene portal
#

Problem in NavMesh

Context: Im making a tower defense that lets you put down walls that make up the maze itself for the enemies
Problem: When putting down walls I should NOT be able to create a wall if it obstructs the pathfinding completely.

checking pathfinding status works however it needs me to create the wall first, the problem with this is it disrupts all NavmeshAgent (making them stop for a moment) and that could be exploitable by the player. Im trying to find a smoother way to do a validation check.

cloud bobcat
serene portal
cloud bobcat
#

And when you don't calculate the path it won't detect the wall

serene portal
hexed wedge
#

Does anyone know how to fix this error?]

"(MLAgentsLowLevelAPI) C:\Users\densanken\Downloads\ml-agents-release_19\ml-agents-release_19>config\ppo\Walker.yaml --run -id =walker_test_002

(MLAgentsLowLevelAPI) C:\Users\densanken\Downloads\ml-agents-release_19\ml-agents-release_19>
[main 2024-04-16T07:15:56.251Z] update#setState disabled
[main 2024-04-16T07:15:56.252Z] update#ctor - updates are disabled due to running as Admin in user setup"

if you know anything about this, please tell me information😭

autumn patrol
#

dont run as admin

main wedge
#

There's this tiny ledge that my guy can't climb up, I've tried adjusting the step height but that isn't quite working. Any way to fix this?

shy ice
#

I have a plane, one mesh that has generated nav mesh, but my agent wont go off the Nav Mesh Link, anyone knows why?

The agent cant find any path from the Nav Mesh Link.

hexed wedge
# autumn patrol it says "updates are disabled due to running as Admin in user setup"

Thanks u for ur kind reply! But next, I'm facing other issue😭

    ↓↓Error code

(Ana_env_mlagents_19) C:\Users\densanken\Downloads\ml-agents-release_19\ml-agents-release_19>
[main 2024-04-17T07:05:48.569Z] update#setState idle
[main 2024-04-17T07:06:18.579Z] update#setState checking for updates
[main 2024-04-17T07:06:19.942Z] update#setState idle

What' happening in my computer🥹

p.s. I made Anaconda environment again, then I solved this issue. Tysm!

elfin cliff
#

Does anyone know the problem when nav mesh agent doesn't go to the destination, instead he moves like a yo-yo back and forth with like 1 meter distance?

#

Destination is reachable

celest loom
#

Does anyone know if thre is a way to traverse with an agent multiple navmeshdata (surfaces)? Context: It is a 3d procedural world, I ca't use navmeshlinks since it is not flat and procedural. It is big (5km>) thus it has to be split into multiple navmeshdata to compute the navmesh at runtime. Everything works except AI stops at borders( recognized has obstacles apparently).

#

Thout the new experimental.AI could be a solution (i.e. navMeshQuery.GetPathResult etc..) anyone knows if this together with NavMeshWorld can travers multiple NavMeshdata?

grand pasture
grand pasture
#

how to use the a* pathfinding to move an agent to a target and destroy unwalkable walls if infront of the target in unity❓

celest loom
#

thats pretty generic, I would watch some youtube tutorial. If you are starting forget about A*, unity navmesh are more than enough\

grand pasture
#

Like this, when the AI finishes to destroy the outside buildings, they move directly to destroy the wall infront of the target, and since a wall was already destroyed, the other agents just passes through that opening to get the target

molten sequoia
grand pasture
grand pasture
hexed wedge
#

Hey guys, I'm planning to make chasing AI and escaping AI ,but then, should I use two cmds in parallel? or do you have any other way?

humble plover
#

Hi, i've been trying to implement my melee enemy as a network object using netcode for gameobject. Since i add the network component on my prefab, the enemy is doing weird things that he does not make when implemented without these component. Here's a clip that will bether illustrate my problem.

nimble gorge
jolly lodge
#

Is there a way for two types of agents not to collide with each other?

jolly lodge
#

Okeii thanks

hexed wedge
dark cosmos
#

Currently trying to make my own enemy AI, the two issues I have is that it doesn’t abide by the speed value in the nav mesh agent component and the state machine does not seem to activate.

hot mason
#

by karboosx

vocal vortex
#

Heya

dark cosmos
ornate adder
#

Hey,in unity i want to use nav mesh for ai but the problem is that the whole world and character...Are not oriented the way they are default,i rotated eash of 'em.is there a setting in nav mesh to be vertical?

old timber
dark cosmos
#

Fixed my AI issues, turns out adding a character controller to the object with the NavMeshAgent broke it.

ornate adder
#

I solved it , don't tell it's not possible if you don't know

old timber
#

there is no official support for vertical navmesh

rustic obsidian
old timber
native pawn
#

Guys, what does this dotted line mean?
Before the bot came to the corner of the room, this dotted line was a simple arrow

restive breach
#

If I create a terrain, example I paint the whole thing grass... then I raise some areas to make some mountains, then I paint a pathway thru the mountains... is there a way to make the new painted pathway a different layer. Or perhaps identify the newly painted pathway as something different than the rest of terrain? I want to make the dirt pathway as a walkable area...

night star
#

Do I need to understand A* pathfinding or can I just work from navmeshes + statemachine or behavior tree etc.?

teal bloom
#

Hi, so I am making a top down 2D game. I have been using A* pathfinding for my enemy AI movement. So far, it is working fine and I have not run into any issues. However, I have a question for those familiar with A*. If you raise the travel costs of particular nodes or add penalties during runtime, are these changes immediate? Or do you have to rescan the graph in order for these penalties to take place.

crisp cargo
#

Assuming I use AI navigation for my game's movement, (I want to be able to choose a position with the mouse, and have the character navigate to it around obstacles) Is there a way to precalculate an AI's pathing, so I can draw a visual line from where they are, to the path they want to traverse?

#

Maybe using Unity Splines?

raven rapids
#

Are you asking how to get the path data, or how to use the path data to draw something?

#

You can ask the NavMeshAgent for its current path.

raven rapids
#

Once you have the path, you'll want to look at its corners

#

You could use a Line Renderer to draw a line through all of the corner points

#

or the Shapes library, or a Spline with an extruded mesh on it, yeah

crisp cargo
#

Gotcha, thank you for the help!

raven rapids
#

If you are doing this every frame, you should use NavMeshPath.GetCornersNonAlloc. You give it a Vector3[] and it puts corners in the array

#

otherwise you generate a ton of garbage every frame, since it'll have to create a Vector3[] to give you

crisp cargo
crisp cargo
#

When you calculate a path, does that path take into account stuff like other agents? Like if I wanted my AI unit to always travel around other units, and draw that path correctly.

hexed leaf
#

Hey everyone. How do people normally deal with something like this? The character has a navmesh agent. I'm directing it to the chair. Once it reaches the chair, I tell it to play a sit animation. However, due to the NMA, it's sitting about .30 too far forward and just kind of hangs there. A second issue is, the navmesh around the table and chairs. The animation I have "requires" the character to be facing the front of the chair. My current idea for a "solution" is to turn off the NMA, teleport the character to the correct position, play the animation and do the reverse when it needs to stand.

jaunty raft
# hexed leaf Hey everyone. How do people normally deal with something like this? The characte...

you are on the right track, navmesh is only meant to give you a path into the vicinity of your target, from where you then handle the details via other means, typically you'd have the navmesh agent move to a defined point (on the nav mesh), then disable the navmesh agent, then move/rotate the character into the start-pose of your sit-animation, then play your sit-animation, you can try blending the navmesh agent and the animation actor to create a fluid transiton but thats a rather advanced goal.

hexed leaf
raven rapids
#

Something annoying I discovered about the NavMeshAgent -- even if you have updateRotation disabled, the agent still messes with your rotation!

#

It sets your world X and Z rotation.

#

I'm using an agent solely to suggest a direction to move. I wound up putting it on a child object.

uneven current
#

Anyone know why navmesh is baking inside Building?
(cubes with box collider)

It's only separating with gap but still bakes inside a solid mesh.. I don't remember old NavMesh baking doing this, I tried all different settings on Surface. What is going on here..

uneven current
#

so basically because the building is taller than the agent height , the area is valid for baking.

#

easiest non-thrid party fix is to add Navmesh obstacles to everything, or volumes.
annoying af

hexed leaf
raven rapids
uneven current
raven rapids
#

darn

#

well I still bet

#

double down

buoyant vault
#

Hey friends. Anybody here have experience with various AI systems?
I've been building mine out for a while, and am struggling a lot. Here are the outlined features:
Cover, suppression, varying states of attention and various tactics in combat (accurate fire, suppressive fire, run n gun, bum rush, etc) based on panic levels, impatience, and skill states

I tried implementing behaviour trees (using C#), but it just doesn't click for me. I can't seem to concisely organize the flow of behaviour in a way that isn't bulky and makes sense (like not using whole states just for checks, see image).

I can't fathom how this would be done with an FSM, and there's no way this game needs GOAP, the AI is simple. So what? Am I looking at behaviour trees the wrong way, or can it actually be done with an FSM? Please help me out. Thanks

raven rapids
#

so yeah, I haven't done much with behavior trees before

buoyant vault
#

Only watched a couple videos about all three, First time making any sort of AI, after 3 fuckin years of this engine

raven rapids
#

GOAP is good for figuring out large-scale ideas:

  • I want to shoot X but I need a weapon
  • I want to pick up a weapon but I'm too far away
  • I want to walk to the weapon
#

It can quickly get out of control though

#

I was experimenting with plugging my objective system into the AI so that it could reason about its objectives

#

it wound up figuring out a plan to complete three sub-objectives

#

to do so, it figured out every conceivable way to do them (including how to move around to reach the objectives)

#

bit of a combinatoric explosion

#

I originally tried implementing GOAP because I was having an annoying issue

#

i was doing utility AI, where you just pick the action with the biggest score

#

At one point I made the score for "chase player" higher than the score for "attack player"

#

(because I made "chase player" more favorable when a condition was met, and that pushed the score too high)

#

so the enemy just walked at you

#

With GOAP, I just declare I want the player to be attacked, and the system figures out that it needs to chase the player

#

It only chases the player if it's necessary.

buoyant vault
#

Yes, I see that goap is more oriented towards long term planning

#

So no goap

#

What about an FSM vs BT? those are the most similar

raven rapids
#

It seems like BTs can do a better job of expressing a long sequence of tasks. You don't have explicit transitions between states.

#

you just have tasks that run until the BT decides a different task should happen

#

I use a state machine for actions in my game (e.g. pulling a lever is a state). It's a bit non-standard, though -- all of the transitions are explicit

#

the machine doesn't automatically change states as conditions are met

raven rapids
#

I guess you can improve this by creating a hierarchy (like how an Animator Controller can have sub-state machines)

somber dawn
#

Anyone know why my AI changes the path every time i run it? Sometimes it works, Sometimes it doesnt

buoyant vault
#

So as a verdict, behaviour trees are the way to go for my case? I already showed you an outline of what I would build for the tree when I get back, does that look right? It's terrible

jaunty raft
buoyant vault
#

I don't want to wing it with my tree doodles and find out I missed something along the way, I'm kind of pressed on time

#

Do you really have to make states for simple if statements? For example, the InRangeCheck. It's ridiculous.

buoyant vault
#

I have no idea how to include cover into this

#

Revised version

#

And I forget logistics, like moving into a suitable fire position

#

So many little things to take care of, it would be really helpful to have some example to go off

jaunty raft
# buoyant vault Well that seems easy in essence, the FSM would itself be a state. My biggest pr...

You'd use the FSM to declare the agent's primary decisions or goals, then implement each of these decisions as a BT. There is usually little reason to stuff a FSM inside a BT since at that point, you've probably already overused the BT metaphor. Typically BT should be simple and not implement anything that requires complicated fallback/exit handling. The main goal of combining FSM and BT is to simplify the AI. If you feel modelling three IF-statements with a FSM is cumbersome, you shouldn't do it. FSMs are only really useful if you use them to separate transition declaration from state implementation. If you then also aren't using your FSM to validate your transitions its value is very limited. The same goes for a BT, they are great to cobble together a bunch of high-level actions in select/sequence but are miserable for implementing the details of each. In a BT you should spend most of your time writing the BT actions and actually very little time in the BT itself.

#

Maybe as a guiding principle, try to think of your BT/FSM ai as an engine, that gets a few simple signals form the outside and then can execute suitable actions based on those signals. An AI should not be a "script" or replacement for a bunch of if-statements. If you end up with a signal that is called "Attack" and the FSM then enters the "AttackState" and the BT executes the "AttackSequence", you've missed the point 😉. Maybe a signal could be "StrangeNoiseAtXYZ" and the AI would figure out what to do with that.

raven rapids
#

If each signal has an obvious associated state, then your FSM isn't really doing anything

spiral pulsar
#

I wrote a class that follows another agent. To stop somewhere behind the protagonist I set the stopping distance to 1. Obstacle avoidance is set to none because my game is 2D and I want my protagonist to pass through the follower. Now my question: Why does my followers _agent.hasPath not turn to false when my protagonist stops within a distance of 1? The state I end up is:

Debug.Log(_agent.remainingDistance <= Vector3.Distance(transform.position, _agent.destination)); returns false.
Debug.Log(_agent.hasPath) returns true.
Debug.Log(_following.hasPath); returns false.

My follower class does not have any crazy code, it just calls _agent.SetDestination(_following.destination);. So the question is: Why does my follower not stop its path? It stops moving in any direction but walks on the spot.

#

One other thing that confuses me: When I set the followers stopping distance to 0-0.4 the actual stopping distance is more like 0-0.01 BUT my follower stops moving. The error only occurs when the stopping distance is greater or equal to 0.5. I don't understand this at all.

fiery pendant
#

Is there an AI where you can upload files or several files that can help analyze logic errors in complex code?

vast viper
#

Hi all
In my scene tab, there's usually this gizmo on bottom right shown in the screenshot

#

But i have a new project and this thing doesn't show anywhere

#

Also in the new project, i just can't bake the navmesh. No navmesh gets generated. I guess it's kinda related?

spiral pulsar
#

Not sure but have you imported the UnityEngine.AI package? I don’t recall if its enabled by default or not.

vast viper
#

Yes it's there

#

I'm actually using NavMeshPlus which is an extension of NavMeshComponents

#

It works fine in my other project, but not really in this other one

raven rapids
#

This will open a list of overlay menus

#

you probably have AI Navigation unchecked

raven rapids
vast viper
#

Ah yea

#

But no it was something else. My Navigation tab was on but not active (not in front, check ss)

#

Didn't know about ~ tho, looks handy

upbeat dagger
#

keep getting this error because i think when i generate the floor (which has the navmesh) and then the enemies, the agent somehow doesnt detect the navmesh

raven rapids
#

Are you setting the position of the enemy after instantiation?

#

If so, it's too late: the agent has already tried to find a navmesh

upbeat dagger
#

no i set it when i call instantiate

solid thistle
#

Hi guys, do you know some tutorials where I can learn about making AI for unity (an android platformer game) ? (collecting game data [deaths and time to complete a level ] and feeding it into an AI to generate the next level with a procedural generation algorithm )

dense basalt
#

Hello. Help please. How to make agent to turn in the player direction even if agent is in stopping radius?

vivid marten
#

My navmesh has a lot of partial paths. Doors have a NavMeshObstacle component in order to make navmesh updating automatic and faster.
My problem being, I am trying to make the enemy find the shortest path to the player. As mentioned above, the path consists of multiple partial paths.
2nd attachment is the script I have attached to an test enemy to try and navigate. I just need something at line 61 which can actually do a proper navmesh calculation, rather than get a distance which ignores the surface.

#

Here's a recording for my issue; The moving camera is the player. Because of line 61, the distance between connectors results to be the same connector, making the enemy get stuck. As soon as i come closer to the enemy, it does figure out the path.

silver fox
#

i am using a behaviour tree based on this video
my question is how are sequence nodes supposed to work?
do they all execute in sequence every frame or one after another until the previous node is finished?
https://www.youtube.com/watch?v=aR6wt5BlE-E

#unity #csharp #gamedev #behaviortree #behaviourtree #tree #ai
In this Unity tutorial, let’s see how to implement a basic behaviour tree to make a simple guard AI!

🗒 Text version on Medium: https://mina-pecheux.medium.com/how-to-create-a-simple-behaviour-tree-in-unity-c-3964c84c060e
🚀 Github repository with the code+assets: https://github.com/M...

▶ Play video
raven rapids
#

then you keep doing that over and over, every time you run the sequence node

silver fox
#

lets say i want an enemy to look for player, then wait some time, then start chasing

#

this is what i am doing rn:

sequence node
check for player in fov > wait for seconds > start chasing

#

and what i should be doing (?):

sequence node
check for player in fov > wait for seconds
|
start chasing

silver fox
#

also can/should i use behavior trees like nodes in other behavior trees?

meager canopy
hollow tapir
#

i have a problem after i done a bake and saved my loading scene time how take 2 hours with this in unity 2022 .3.29f1 were do i look to fix this slow loading , if i delete the nav bake it back to loading in mins.

#

so please anyone have idea what i need to do to fix as i can not use ai navigation right now

sharp fern
#

Can i use a computer vision with ML agent

#

If you know any tutorial about it , share with me

jagged jay
#

Hi!

Currently trying to bake a NavMeshSurface over a large area along some traintracks that generates in chunks as the player moves.
Right now I'm baking the NavMeshSurface during runtime as it'll need to generate new NavMeshes for every new chunk.
But baking causes some hitching so just wanted to check if anyone has a more efficient way of baking new NavMeshes during runtime?

Also wondering if it's even the best way of going about this issue. The AI would mostly consist of creatures and villagers which for the most part would wander around an area and some would have objects that they are more likely to interact with.

violet wyvern
#

can i force NavMeshAgent to take another path to the object, not the quickest one? how do i access all possible paths?

spiral pulsar
#
[SerializeField, NavMeshArea] int m_area;
void Awake()
{
    m_area = m_agent.areaMask;
}```
Why does this show a blank field in the inspector?
spiral pulsar
violet wyvern
#

Ok, thanks

high cape
#

Hi guys! Currently I am working on a top down 2D project and I have some issues now that I want to introduce some Navmesh Surface to my project . I installed the new AI Navigation package but it seems I can bake navmesh surfaces only on 3D planes so far. It does nothing with my 2D tilemap.

Any idea if the issue is related to my 2D tilemap? Is this compatible with AI navigation package?

Should I use NavMeshPlus for my project? Thanks in advance.

molten sequoia
high cape
molten sequoia
weak shadow
#

Hello there, i would like some help with GOAP ai system in unity, i have set up my scene with just cubes for now, and they have one goal of wandering, but they teleport around, would this be because i dont have animation on then or did i do somethig wrong ? Appreciate anybody that could help me

raven rapids
#

that's not an AI problem

#

The planner's job is to come up with a sequence of actions

#

How you execute those actions is a separate matter.

weak shadow
#

Im using crashkonijn goap system to make the code, here is the movebehavior:


[RequireComponent(requiredComponent: typeof(NavMeshAgent), requiredComponent2:typeof(Animator), requiredComponent3:typeof(AgentBehaviour))]
public class AgentMoveBehavior : MonoBehaviour
{
    private NavMeshAgent navMeshAgent;
    private Animator animator;
    private AgentBehaviour AgentBehaviour;
    private ITarget CurrentTarget;
    [SerializeField]private float MinMoveDistance = 5f;

    private Vector3 lastPosition;
    private static readonly int WALK = Animator.StringToHash(name: "Walk");


    private void Awake()
    {
        navMeshAgent = GetComponent<NavMeshAgent>();
        animator = GetComponent<Animator>();
        AgentBehaviour = GetComponent<AgentBehaviour>();
    }

    private void OnEnable()
    {
        AgentBehaviour.Events.OnTargetChanged += EventsOnTargetChanged;
        AgentBehaviour.Events.OnTargetOutOfRange += EventsOnTargetOutOfRange;
    }

    private void OnDisable()
    {
        AgentBehaviour.Events.OnTargetChanged -= EventsOnTargetChanged;
        AgentBehaviour.Events.OnTargetOutOfRange -= EventsOnTargetOutOfRange;
    }

    private void EventsOnTargetOutOfRange(ITarget target)
    {
        animator.SetBool(WALK, false);
    }

    private void EventsOnTargetChanged(ITarget target, bool inRange)
    {
        CurrentTarget = target;
        lastPosition = CurrentTarget.Position;
        navMeshAgent.SetDestination(target.Position);
        animator.SetBool(WALK, true);
    }   

    private void Update()
    {
        if (CurrentTarget == null)
        {
            return;
        }   

        if (MinMoveDistance <= Vector3.Distance(CurrentTarget.Position, lastPosition))
        {
            lastPosition = CurrentTarget.Position;
            navMeshAgent.SetDestination(CurrentTarget.Position);
        }

        animator.SetBool(WALK, navMeshAgent.velocity.magnitude > 0.1f);
    }
}

raven rapids
#

perhaps you have the agent set to have an extremely high speed

weak shadow
#

This is the agent

raven rapids
#

looks fine to me

weak shadow
#

I tried changing the speed but it teleports anyway

raven rapids
#

if they're teleporting around, then something else is moving the game object around

#

Make sure the animator isn't controlling the object's position

weak shadow
#

I dont uderstand very much about animation and animation controller, maybe it is, i will search more about it

sterile dock
#

i had this problem too, even if theres absolutely nothing else in the script except set destination, with speed low and all, it just teleports

#

even with the speed at 0 actually

sterile dock
#

i think the ai module in general just goes haywire occasionally

#

i now have a blank script but with one debug log

#

whenever debug log gets called the agent teleports to the nearest edge

#

this is a completely blank script bro... somethin gotta be up

sterile dock
#

seems like this has been around for a very long time

#

dunno if its going to get fixed any time soon

#

copy and pasting the entire project into a new project fixed it

#

i guess we'll never know the true cause?

raven rapids
#

i've never observed that

sterile dock
#

weirdest thing ive ever seen

#

fixed now though so no problem

#

i hope...

gentle quest
#

is there a way to autogenerate a navmesh?

raven rapids
#

I'm not sure what that means

#

At runtime?

solid thistle
#

Do you know how to make a regression linear model with multiple output ?

oblique perch
#

Hi, I am planning a game, I would like to know how deterministic nav-mesh-agent is. Could I expect the exact same results for the exact same configs?

If the path-following is not 100% deterministic, I would expect the path-finding to be at least so I could code my own deterministic path-following, is that possible?

oblique perch
fiery bear
#

This is my game and the player is in the corner of the map, and the zombies will spawn on the left side. I am using nav mesh, but the zombie is stuck right there and wont come through

echo widget
#

Hello ,

i'm looking for copilot to help me and improve easily the code in my game

Someone have already use something like this ?

Which one is the better for this use case ?

oblique perch
oblique perch
dusk canopy
#

Hello, I'm using unity's MLAgents to train some models and I'm trying to figure out how to switch between training the model and just testing it during runtime.

#

is it possible to save the model that has been trained up to a certain point and then load it to just test the trained model?

#

also will putting the agent into inference mode stop training the model?

raven rapids
crisp cargo
#

Okay, so, I'm about to get started on working with the AI Navigation stuff, and one thing I'm struggling to figure out is when and how a Navmeshagent determines a path.

NavMesh.CalculatePath doesn't seem to take into account the size of a Navmesh Agent, so when/how does a Navmeshagent determine a path based on its size? If a tunnel is too small for a Navmesh Agent, it SEEMS like Calculate Path doesn't actually care, and will generate a path through the "too small tunnel" anyway?

Can anyone help me understand a bit more about what's going on under the hood, here?

grand pasture
#

Hello everyone, I have some issues using the a* pathfinding asset, I don’t know if someone uses it or can help me with some knowledge on grid system and pathfinding.
In my project, I have a grid graph from the a* pathfinding where the agent(seeker) can move and I have a target. I have 4 agents and 1 target.
These are my problems:

  • Firstly, “same spot”. whenever I set the agents to move to the target, they follow a path and some of them reached the exact same location. I have tried to use the node.RandomPointOnSurface() which kind of work but not as expected since it is random, it doesn’t choose the nearest path to the target. At this stage, I don’t know how to vary their paths and get the nearest point on the node simultaneously.
  • Secondly, “rotation toward target”. I’ve tried leaving the destination as it is by removing the node.RandomPointOnSurface() but when the end of the path is reached, they don’t look at the target. I’ve tried to set their rotations using their transform but it behaves strangely.
  • Thirdly, “target size on node”. when setting the target, the algorithm seems to not take into account the size of the target. For example, I upscale the target and the agent still move to the same spot without taking into account the size of the target. And also, the node occupied by the target is unknown. I mean the grid size the target occupied, either is 1x1, 2x1…
    I passed through forums, documentation and I couldn’t get any help.
    Please look at the video, it what I want to achieved.
    Look at how the agents spread out to destroy the wall. They move to a target but they are not all in the same spot.
bright star
#

I need to allow my bots to clip through each other, but the default behavior of NavMeshAgent result in them pushing each others around (they have a character controller but the layer they are on does not collide with itself, so it seems this behavior comes from the NavMeshAgent). Is there a way to turn this off and make them ignore each other?

raven rapids
#

I would like to compute a bunch of navmesh paths. Is there anything better I can do than just doing them one at a time?

#

I noticed that there was experimental Jobs stuff in the past

#

but it looks like that code was removed

novel stump
#

Navmesh not generating on the floor correctly, need help.

crisp cargo
#

Question, how long does it take for a NavMeshObstacle to stop carving, after you disable it?

teal bloom
#

For anyone experienced in A* pathfinding, is there a way you can specify the agent/enemy size? I am running into an issue where an enemy's physics collider is getting caught on wall corners due to the pathfinding generating a path too close the the corner.

terse tartan
#

Why does baking only seem to work properly with planes and not a grid of cubes for example? I want individual cubes (tiles) to make up the walkable surface instead of just having one big plane. Doesn't matter if I use the rendered mesh or physics collider of each cube to bake.

raven rapids
#

what is the problem, exactly?

raven rapids
#

What if you reduce the agent height?

#

(this wouldn't be a permanent fix; it's just to see what happens)

novel stump
#

Yeah i ended up figuring it out. One of my prefabs had a navmesh obstacle that extended extremely far

elfin burrow
#

Hello folks, I have a problem that using Navmeshagent in version 2021.3.35f1, my AI pathfinding works smoothly in Unity editor but when in build it doesn't work at all.

#
private void GameStart() {
        InvokeRepeating(nameof(UpdateDestination), 0.5f, 0.5f);
        StartCoroutine(PassiveSpeedUp());
    }

    private void UpdateDestination() {
        agent.SetDestination(playerPosition.position);
    }
#

this is my code used on enabling the AI which purpose is following the player

raven rapids
#

make a Development Build and see if errors are appearing

summer forum
#

does this look normal?

fathom arch
#

If you want some objects to be non walkable (like the box on the left), you can add a NavMeshModifier component to it and make its area Not Walkable

summer forum
fathom arch
#

In what way?

summer forum
#

never mind i fix it

fathom arch
#

Great.

summer forum
#

it was probably because of the boxes lol

#

I didnt make them non walkable so it got messed up

lament crystal
#
python -m pip install ./ml-agents
#

is this for installing mlagents

#

outputs this error

raven rapids
summer forum
#

the monster can't go in the room how can fix this?

raven rapids
#

Your agent radius it too high.

#

The gap between the mesh and the wall is the agent radius

#

so it can't fit through anything that's less than twice as wide as that gap

sick quail
#

Ok So Im completely new to navmesh and I have an enemy that should attack the player but he moves extremely weird and not even close to what I want...
3 Problems:

  1. The stopping distance doesnt work (if the enemy moves really slow then it works)
  2. The enemy slides around when I stop(you see it in the middle of the video i walk fast->i stop> enemy slides behind me
  3. When I circle around the enemy it rotates and dont really come any closer and is not a threat
    I would love if anybody could help me!
raven rapids
#

Your enemy has a massive stopping distance and a very low acceleration

#

(5 means they take 1 second to change their speed by 5)

#

this means the enemy is going to be prone to overshooting its stopping distance in some cases

#

and stopping really far away in other cases

#

Increase the enemy's acceleration significantly and it should behave better.

sick quail
#

But the sliding doesnt get fixed @raven rapids

sick quail
stuck flint
#

Hi, quick question, why on the navmesh the auto generated links are not bi directional, they only go down not up

raven rapids
#

They represent dropping down from a high place to a low place

#

"Jump Distance" is for horizontal jumps

#

and unfortunately, you can't just iterate over all of the generate links and add your own backwards links

#

i don't know why! design error.

stuck flint
#

I saw that. I'm creating an map using a map editor that the user can also use. So I but manual bi-directional links on the parts for the IA to use. it's actually better that way

hollow tapir
#

if i want water to not have navmesh bake in it how do i remove so it does not bake water using 2022.3.33f1

fathom arch
#

Or you can select 'Ignore from build'/'Mode->Remove Object' depending on your version, if you want to ignore it in the bake

hollow tapir
#

thanks i will try that

kind spire
#

I have some small arena prefabs that I pick randomly and instantiate at different places at runtime, but they need a navmesh for the AI navigation to work.
What's the best way to go about this, is it possible bake it into the prefab? Sometimes baking at runtime produces some wonky results. UnityChanThink

plucky ibex
#

when I build

#

how do I know if low resoultion aspect ratio is checked or unchecked

#

so when I uncheck the low resolution aspect ratio does that means the final product would not be low resolution aspect

raven rapids
#

It has nothing to do with the build

#

This also has nothing to do with ai or navigation

timid stone
#

how do i make a certain object have the blue floor for the ai to walk on

timid stone
#

got it working nvm

raven rapids
#

I'm having some trouble with my GOAP system.

Entities make a list of goals. Each goal has a score. The entity discards all goals worse than the current plan's goal, then tries to make plans for the remaining goals.

I have a goal called "Explore", which is satisfied by performing a wander action. Wandering picks a random point and goes to it. The goal's score is based on how bored the entity is. Entities get bored when they're idle and lose boredom when not idle.

I'm winding up with "flapping":

  • Entity boredom gets to like 51%
  • Explore's score is now higher than the Idle goal's score, so it gets picked by the planner
  • The entity starts wandering
  • Boredom goes below 50%, because the entity isn't idle
  • Explore's score is now lower than the Idle goal, so Idle beats it
  • The entity goes idle again
  • 20 GOTO 10!

I have considered the following, but I don't like any of them:

  • Save the score of the goal when the plan is created, rather than constantly re-calculating it
    • This prevents an entity from giving up on a goal it should no longer care about
  • Make it so that the Idle goal is only considered if there are no other valid goals
    • This makes idling "special", and other goals would also be able to almost immediately interrupt the wandering
  • Don't allow wandering to be interrupted
    • The entity should be able to interrupt the wander if it finds something interesting to do
#

The core problem is that the goal's score drops to 0 almost immediately.

#

I could give the goal hysteresis, so that it "locks" on a non-zero score until the boredom hits zero

#

That'll add complexity, but it makes sense.

raven rapids
#

after some further thought I might just do this:

Make it so that the Idle goal is only considered if there are no other valid goals

#

It has to have a lower score than any other goal, but it also can't have a score of 0, or else it'd get filtered out

ocean marlin
#

How do I do Navmesh area now? Before there used to be an option that allowed you to select all the ground object and click on bake navmesh or something

raven rapids
#

You add a NavMeshSurface component to something and bake it.

#

You no longer bake navigation for the entire scene

inner kindle
#

Anyone ever make an ai that can make a stick figure stand? Like interactive buddy but with physics? I've put hundreds of hours(probably in the billions of simulated hours) trying to train one. I can't find anything online that satisfies my need for a self-standing fully simulated ai . Making more progress (i think)with the help of gpt now with images. Unity 6 have any hidden features to help with this?

upbeat garnet
#

I posted this elsewhere not long ago then realized this is a channel lol

I have a question about generating a graph for A* pathfinding in a 2D platformer.

My game world will not be represented purely by tiles. So Instead of having a "grid" of nodes and connections where a node is placed above each walkable tile in my scene, could I just generate nodes at the "start" and "end" of platforms? Like over their corners/vertices or something? A grid (like if my world was made strictly out of tiles) seems like it wouldn't be accurate when platform shapes start to get weird, and a node on every tile seems excessive. Best drawing ever of what I mean below.

raven rapids
#

consider how unity's navmesh system works

#

It's not a regular grid: it's a set of polygons

#

If you have a very large empty room, you get just a few polygons in it

#

Once you're inside a polygon, you can move directly to any point in the polygon

#

(because it's a triangle, which is, by definition, a convex shape)

#

more complex polygons wouldn't necessarily work, since you could have a shape where some points can't be reached from some other points

raven rapids
#

I'm not sure how you'd do that, though!

ocean marlin
jaunty dock
#

I have this floor, the NavMesh see it as "heigh" but the inset would be more or less 0.01 or 0.02 😒
Any advice to fix it?

#

It also have a box collider, so I really don't get why it does that 😕

jaunty dock
#

Anyone?

raven rapids
jaunty dock
#

This is the surface, which is placed on the root gameobject that holds all the walls and floors

raven rapids
#

Is the box collider on the correct layer?

#

also, if the floor has its own MeshCollider, I would remove it (or get it excluded from the nav mesh computation)

#

It could be interfering.

jaunty dock
#

This is the floor, at the moment it is scaled by 0.5 because of the navMesh 😅

raven rapids
#

this doesn't show which layer the box collider's object is on

jaunty dock
#

Oh the layer is Default

raven rapids
#

Okay. Do you have any other colliders?

jaunty dock
#

Nope...

#

I mean now that the navmesh is fine I could rescale it as it should... but this is boring, buecase if I will need to rebake it I could forget about it and... 😅

raven rapids
#

You can search for t:collider to check

jaunty dock
#

Yes, there's only the box collider.

#

This could be the reason? 🤔

#

I need to fix the collider size

raven rapids
#

I don't really know what I'm looking at here

jaunty dock
#

Because once scaled by 1,1,1 it's even more noticeable, but ... are talking about so small stuff

#

Oh it's the side view of the floor 😄

#

Yea, Synty messed up again, the collider was inside of the mesh so maybe the navMesh was reading the mesh's vertex?

raven rapids
#

no, the NavMeshSurface only cares about colliders when you set it to use Physics Colliders

#

You can check if other colliders are present by turning off this box collider and baking the nav mesh.

jaunty dock
#

But now that I've increased the collider, the navMesh is fine 🤔

raven rapids
#

presumably because there are other colliders that are being included when baking the nav mesh

jaunty dock
#

I've increased the navMesh on Y from 0.21 to 0.22 and it fixed the issue... still weird, but for me it's enough
Thank you 🙂 🍻

raven rapids
#

you should figure out why you're having a problem, so that you can avoid the problem in the future

jaunty dock
#

I agree, but as you can see that's the prefab and it have just a box collider

raven rapids
#

okay, but what do you actually have in your scene?

jaunty dock
#

A bunch of stuff, and also 2 triggers which should be fine

#

For the rest there's nothing here...

#

Also the ceiling have MeshCollider which use the same Mesh that the MeshFiler use so, can't be the ceiling...
Still I think it's about NavMesh that collided with the floor MeshFilter 🤔

raven rapids
#

MeshFilter has nothing to do with physics colliders

#

It has zero effect.

#

as does a MeshRenderer component

#

the only things that matter are colliders

#

It's possible that your ceiling is just low enough to start interfering.

jaunty dock
raven rapids
#

as in, the ceiling is physically too close to the ground for the navmesh to make that area walkable

jaunty dock
#

the Ceiling is at 5 meters up, while the floor have a thickness of 0.2

#

What was poppoin out from the navmesh was the border of the squares...and those avoid the Agent to walk on it.

raven rapids
#

This implies that you have a collider attached to the floor. It doesn't matter if your prefab doesn't have extra colliders.

#

I would still try disabling the collider on the ceiling, if one exists, to make sure it's not relevant

jaunty dock
#

I need it for the bullets, but yes, could be a solution, at least worth to try.

dense basalt
#

Hello! How can I fix it so that enemies following the player will bypass each other?

glossy geyser
#

my navmesh is moving along with my agent, so the agent is going through the real terrain, can somebody suggest a fix please

raven rapids
#

the NavMeshSurface should not move

glossy geyser
#

Yes

glossy geyser
raven rapids
#

I would suggest putting it on the root object of your level geometry

glossy geyser
#

so I should assign the agent to the terrain?

raven rapids
#

Parent all of your static objects (terrain, building meshes, etc.) to a single object. Put the NavMeshSurface on that object.

#

I have mine configured like this. Note how "Collect Objects" is set to "Current Object Hierarchy"

#

That means it only looks at its children

#

it's also set to use Physics Colliders, and it ignores everything that isn't on the Map layer

#

Then attach NavMeshAgents to the objects that need to move around on the navigation mesh

glossy geyser
#

THANK YOU SO MUCH 😭

#

it works

lament crystal
#

Hi! So for the Space Size when I put it 3, it gives a warning message that it should be 6, when I put the space size as 6, I get this error message: Observation at index=0 for agent with id=51 didn't match the ObservationSpec. Expected shape (22,) but got (44,).

raven rapids
lament crystal
#

I can't seem to find the AI Navigation package in package manager?

#

I am using the 2021.3 version

#

I downloaded through com.unity.ai.navigation

#

that's experimental though

molten sequoia