#๐Ÿค–โ”ƒai-navigation

1 messages ยท Page 12 of 1

bronze otter
#

Hi can someone help me with ML -agents in unity the document says " LSTM models from previous releases no longer supported
The way the Unity Inference Engine processes LSTM (recurrent neural networks) has changed. As a result, models trained with previous versions of ML-Agents will not be usable at inference if they were trained with a memory setting in the .yaml config file. If you want to use a model that has a recurrent neural network in this release of ML-Agents, you need to train the model using the python trainer from this release. How do i use the LSTM any reference to using using photon code ?" Which file i need to change to add LSTM to the Model ?

unkempt talon
#

is there any free ai assets anyone would recommend?\

tardy junco
unkempt talon
tardy junco
#

Behaviour? Navigation?

unkempt talon
#

behavior i think

tardy junco
#

Of the first one, yet again there are plenty of solutions. State machines, behaviour trees, goal oriented action planning and many more.

#

If it's simple ai, I'd go with a simple state machine.

tardy junco
# unkempt talon behavior i think

Here's one simple and clean implementation that I use for simple ai.
https://youtu.be/V75hgcsCGOM

Build bots for your Unity game with a powerful but simple to manage state machine built completely in c#. Learn how to use the state pattern in unity, building an AI to control harvesting bots that could be used for an RTS, building game, shooter, or anything else. We'll dive into transitions, states, ai, bots, and how to hook it all up in a cle...

โ–ถ Play video
#

You can download the source code and use it as is, but I really recomment watching the video first.

unkempt talon
#

alright thank you

wary ledge
#

Anyone familiar with Aarons A*?\

#

Or rather, Arons?

hexed sequoia
wary ledge
#

Any ideas?

hexed sequoia
#

my best guess is it's related to your settings for node size and character diamater

#

my node size is .32 and my diameter 1.41

#

the fact that the blue pathfinding grid in your screenshots is right up against the walls is likely your problem, and if you adjust those settings you should get something closer to my screenshot, with space from the walls/obstacles

wary ledge
hexed sequoia
#

yeah on the Pathfinding, I'm uysing the Grid type too

wary ledge
#

Like it still looks odd? Why is one side different than the other?

#

And what do you set pick next waypoint to? @hexed sequoia

#

Because he ends up doing this as well... Like.. Wut?

(Stops moving here)

hexed sequoia
#

not sure about the about the way point question, as for why he's getting stuck that is a bit strang e-- is the pathfinding radius/diameter equal to the collider on the object? if not that might be why

#

I'd check for any exceptions in console, too

wary ledge
#

I'm currently Presenting if you want to see.

#

Trying to debug live with my 2 friends watching lol

wary ledge
#

Like it looks like its not taking into consideration that the unity is 0.5 Radius.

#

Or even the Seeker doesn't take into consideration its size?

hexed sequoia
#

(sorry gotta run but best of luck ๐Ÿ‘‹)

wary ledge
#

If anyone else knows anything about it, I'd love some help. I dont get why its getting stuck.

severe moth
#

Hey everyone.

I am trying to build a NavMesh on runtime for a tiling level which I generate procedurally. Each tile has a navmesh source which I push into a list<NavMeshBuildSource>. I then do a:
NavMeshData nmd = NavMeshBuilder.BuildNavMeshData(bset, navmesh_sources, largebounds , largebounds.center, Quaternion.identity);

The problem is, it is not building anything. When I trace NavMesh.CalculateTriangulation().indices.Length, I get a 0.

I know I can use the NavMesh Surface component, but I want to figure out how to use the built-in NavMesh classes. Can anyone tell me what I might be missing?

Here is my code for building it:

        navmesh_sources = new List<NavMeshBuildSource>();
        Bounds largebounds = new Bounds(new Vector3(-1000f, -1000f, -1000f), new Vector3(3000f, 2000f, 3000f));
        for (int i = 0; i < tiles_width; i++)
        {
            for (int j = 0; j < tiles_height; j++)
            {
                navmesh_sources.Add(leveltiles[i, j].navsource);
            }
        }
        
        NavMeshBuildSettings bset = new NavMeshBuildSettings();
        bset.agentRadius = .1f;
        bset.agentHeight = .5f;
        bset.agentSlope = 25f;
        bset.agentClimb = 2f;
        bset.voxelSize = 0.02f;
        bset.tileSize = 8;
        bset.minRegionArea = 0.05f;

        NavMeshData nmd = NavMeshBuilder.BuildNavMeshData(bset, navmesh_sources, largebounds , largebounds.center, Quaternion.identity);

        Debug.Log(nmd);                                              ->traces NavMeshData
        Debug.Log(NavMesh.CalculateTriangulation().indices.Length);  ->traces 0
#

I am guessing the indices length would be >0 if it built anything thonk

#

thanks in advance

#

ps: also tried: NavMesh.AddNavMeshData(nmd); with no change in outcome

fringe crag
#

hi there @severe moth i could be wrong here, but i don't think each of your tiled pieces needs it's own navmesh surface

#

you just need one, maybe on an empty game object, and tell it to rebuild once your level is completely loaded

severe moth
#

thanks @fringe crag. Let me ponder this a minute, but, from what I understand, I need to define a volume for each source, then either use CollectSources which pushes all geo in a volume into a list of sources to build them into one mesh, or push them into a list and pass that to BuildNavMeshData. If it required one, I don't see why it would require a list.

my setup looks like this btw:

#

each tile having its own NavMeshBuildSource with shape and size set accordingly thonk

fringe crag
#

ah a buildsource, i'm unfamiliar with that

#

i just have 1 surface for my entire level, and call .BuildNavMesh() on the navmeshsurface

#

when it needs updating

severe moth
fringe crag
#

let me ask a bunch of dumb questions, usually when the navmesh is built and you have a source selected it'll show you the blue mesh in the scene view. do you see that appear?

severe moth
#

yeah nothing appears in the editor ๐Ÿ˜ฆ

#

that + navagent complaining is how I confirmed it wasn't building prior to trying triangulation.indices ๐Ÿ˜„

fringe crag
#

right

#

since i have no experience with the navmesh builder and build sources i can't really comment. But i do know that you could programmatically set a singular navmeshsurface and build once your level is finished "assembling" (or just let it calculate for everything visible if that is everything). and it doesn't require any of the builder components

#

you just set it to use mesh renderer components, or colliders to do it's surface building

#

you could try it out in the editor first to confirm that it connects your tiles correctly before coding it all together

#

otherwise good luck! (i've definitely been having issues with these component based navmesh scripts)

severe moth
#

thank you ๐Ÿ™‚ This doesn't (supposedly) use NavMesh Surface from what I understand. I will update if I can figure anything out.
CollectSources does exactly that btw, you can specify what you want to collect NavMeshCollectGeometry.PhysicsColliders or meshes, and it puts it into the source list to be built.

#

yeah will try some in-editor stuff to explore some more.

#

thanks again Andrew.

fringe crag
#

allow me to ask one more basic question, i see in the docs that any meshes you're using need to be set to read/write (i think by default fbx's are readonly)

#

are you using imported fbx's / objs?

severe moth
#

that's a good point, I am using the primitives in Unity so no fbx's in there.

#

btw, switched to this instead of pushing in the sources to the list:

    Debug.Log(navmesh_sources.Count);```
does populate the list, but still doesn't build.

When I trace the NavMeshData's position, I get the correct position (largebounds' pos), but when I trace the sourceBounds, I get 0 on all fields -> meaning it didn't build
#

ok I am getting bounds info + indices.length on NavMesh.calctriangulation() now, so it is building something believe ๐Ÿ˜„

#

what I changed:
Bounds largebounds = new Bounds(new Vector3(0f, 0f, 0f), new Vector3(3000f, 3000f, 3000f));
it was:
Bounds largebounds = new Bounds(new Vector3(-1000f, -1000f, -1000f), new Vector3(3000f, 2000f, 3000f));
not sure if I clicked anything inbetween, but I think this was it thonk

#

it is built

#

thanks for the pointers @fringe crag

fringe crag
#

ah so instead of passing the center + extends you were passing a start corner + end corner?

#

glad you got it

severe moth
#

yes ๐Ÿ˜„

#

seems that way

severe moth
#

...so...removing the navmesh isn't instant. every new room I am generating, I am rebuilding the navmesh, but it always includes the last navmeshdata's contents in it. so room 1 generates navmesh1, room 2 ends up with navmesh 1+2, room 3 gets navmesh 2+3 and so on. took me a while to realize it takes a second to flush the former room's data. introducing a delay after NavMesh.RemoveAllNavMeshData() fixed it. adding here for future prosperity.

on the left hand side: removes navmeshdata, gets the new one, rebuilds navmesh but it ends up with both the new one and the previous.
on the right hand side: a .5 second delay is introduced.

#

hope this helps someone, I was too slow to get what was going on heh.

#

also do let me know if you know a way to flush it faster ๐Ÿ˜„

violet egret
# severe moth ...so...removing the navmesh isn't instant. every new room I am generating, I am...

worth trying https://docs.unity3d.com/ScriptReference/AI.NavMeshDataInstance.Remove.html

Not sure if it'll have the same problem, haven't had the chance to test, but might be worth checking out. Does the nav data dump out on the next frame, or is it an async task?

If it's always on the next frame, you could have a bool that cycles notifying your system when the new data is available.

Just spitballing some ideas ๐Ÿ˜„

severe moth
#

could simply be async

eternal tapir
small pivot
#

The zombie doesn't run to the player. I'm thinking it has something to the walkable area on the zombie?

molten sequoia
#

@limber glen And I want you to follow out crossposting rules. Don't crosspost questions.

tardy junco
ruby birch
#

im using the A* pathfinding package, is there any built in function that prevents the enemy from seeing the player through walls?

molten sequoia
#

@ruby birch Out of the asset's scope, but you should be able to determine reachability

#

You probably just want to roll your own or get some visibility setup

ruby birch
exotic tapir
#

I don't want to break any rules, but I have a problem I posted in general-code over an hour ago. I think it might make more since here since it involves the NavMeshAgent component. Can I re-ask that question here?

molten sequoia
#

Yes, you can ask questions again once reasonable amount of time has passed. Moving the question here after waiting for an hour is fine.

wind plinth
#

Guys I chose the object with Navmesh and hit bake but it still wont owrk

#

any ideas why?

tardy junco
wind plinth
#

Oh dont worry I fixed it by repeatedly smashing the bake button, sorry for not telling in advance

#

And crashed my unity a few times

wind plinth
#

guys how many methods are there in coding ais?

noble fog
#

You should expand on what you are actually asking. It's not an exact science coding behavior. There are as many methods as you can imagine.

wind plinth
#

well, for example, I want to know which is the best and most efficient way to code an AI

#

so it wont result in a block of mess

#

maybe one that has mulitple behaviour trees?

#

or suitable for that

noble fog
#

It's situational to the purpose. Find Pluggable AI course on Unity Learn. It describes a neat way how to do that for an RTS style with Scriptable objects, for example.

wind plinth
#

right, thank you.

exotic tapir
#

In the current project I'm working on I use both a NavMeshAgent for path finding and a CharacterController to control movement of an AI. The problem is the object's transform.position now returns the NavMeshAgent's position instead of the objects actual position. Is there a way to disable this without disabling the NavMeshAgent?

exotic tapir
#

Okay I think I figured it out. Even though the navmeshagent's updatePosition and updateRotation where set to false it was still trying to fight with the CharacterController for control over the players position. So in update the transform.position returned the navmeshagent position, and in fixedUpdate and visually transform.position was returning the CharacterController position. I can work around this, but is there a way to disallow the navmeshagent from controlling the characters position?

exotic tapir
#

Just an update, I think need help with this anymore. I think I'm just gonna ditch the navmeshagent and get the path directly form the navmesh.

upper ingot
#

Hello, i need help on a specific problem, to which google could not provide me a satisfying answer. I have multiple agents using navmesh, hundreds. When i tell them to reach a destination they glitch together until reaching it then rest. I want a typical RTS behavior here, which is try to reach the point and then come to rest, without forcing into each other. I wanted to use the builtin navmesh for optimization and ease of use, but it seems complicated to prevent glitches between agents. I tried some flow field pathing too but huge grids come at a huge cost and there is no tutorial to my knowledge about how to optimize this.
Has anyone any experience with multiple agents pathing and able to help me with it ?

exotic tapir
#

Is there something that would cause a NavMeshPath variable to delete itself? I have a NavMeshPath variable that I instantiate in the Start method. But its null by the time CalculatePath gets called.

dark vessel
#

Does anyone know how to make people roaming like in GTA

limber glen
dark vessel
#

But how to make them move random pos

limber glen
#

use blender and import them into your unity

dark vessel
#

Hmm

limber glen
#

i have a person on discord who is experts at these things

dark vessel
#

Why didn't I got this idea

limber glen
#

do you want his id

dark vessel
#

No I already have one in my team for jam

#

No

#

Thx

limber glen
#

not for jam

#

you can take his help for this this only

#

shall i send his id?

dark vessel
#

No

#

I can

#

Ik a bit of blender too

tardy junco
#

What exactly is the problem?

dark vessel
#

I wanna make people they should roam here and there

tardy junco
#

Then what I said. Just assign different random destination for the agent to follow.

dark vessel
#

I wanna do this for the jam

#

And I wanna do one quick method

#

Animation is better ig

tardy junco
#

No, it's really faster to just write a small script...๐Ÿ˜…

warm stream
#

I obviously have mesh for it to walk to, but it runs around all crazy

#

the link when single point / wide was also acting different with a different camera position

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


[RequireComponent(typeof(NavMeshAgent))]
public class PlayerMovement : MonoBehaviour
{
    [SerializeField]
    private Camera camera;
    private NavMeshAgent agent;

    private RaycastHit[] hits = new RaycastHit[1]; 

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

    }

    private void Update()
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            Ray ray = camera.ScreenPointToRay(Input.mousePosition);
            if (Physics.RaycastNonAlloc(ray, hits) > 0)
            {
                agent.SetDestination(hits[0].point);
            }
        }
    }
}```
#

is my point to position method poopy?

warm stream
#

Here's the surface settings. I'm following a tutorial step by step and getting absolute trash behaviour from the navmesh.

#

shit like this being a constant really makes me want to give up.

#

Feels about as useful as pissin in the wind.

tardy junco
# warm stream

I don't understand what the problem is from your video or your explanation.

#

I see the agent navigating the navmesh properly

warm stream
#

sorry Obs hid cursor.

#

Anytime I clicked a ledge pretty much it went to the ground

#

when you see it jump on the little ledge and back down it was supposed to jump up to the next

tardy junco
#

First debug the raycast and make sure the first hit point is the one you're expecting.

warm stream
#

so just draw a gizmo at the point?

tardy junco
#

or a debug ray

warm stream
#

okay

warm stream
#

honestly I'm having a super rough time today and I just can't handle doing anything like I'm literally sobbing.

#

I had enemies and animations and attacks and health and knockbacks in a different project and this tutorial had something I wanted to learn and I was stuck on something so I just deleted it and now I can't basic things to fucking work

tardy junco
warm stream
tardy junco
#

share code and a screenshot

warm stream
#

@tardy junco gizmo is drawing fine. Idk why but in playmode navmesh looks like its floatin. Scene view it's on the ground.

#
public class PlayerMovement : MonoBehaviour
{
    [SerializeField]
    private Camera camera;
    private NavMeshAgent agent;

    private RaycastHit[] hits = new RaycastHit[1];
    private Ray ray;

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

    }

    private void Update()
    {
        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            ray = camera.ScreenPointToRay(Input.mousePosition);
            if (Physics.RaycastNonAlloc(ray, hits) > 0)
            {
                agent.SetDestination(hits[0].point);
            }
        }
    }

    private void OnDrawGizmos()
    {
        Gizmos.color = Color.red;
        Gizmos.DrawSphere(hits[0].point, .1f);
    }
}```

Here's the movement code
#

I've noticed depending on camera rotation the navmesh link doesn't want to work at all.

tardy junco
#

Hmmm

fickle ravine
#

I dont really recommend the inbuilt navmesh stuff tbhj\

#

it actually created more problems than it solved for me tbh

warm stream
#

suggestion then?

fickle ravine
#

needed a lot of little hacks and stuff

#

a* path finding project

#

try the free version first

#

you do have to watch some of his vids, look at his demo scenes and read some stuff

#

but the behaviour is better and doesn't screw up imo

warm stream
#

@fickle ravine I just can't understand how absolutely every single ai.navmesh tutorial I've done has produced constant errors

#

Every video things are dandy

#

Every attempt I make absolutelyt nothing works

fickle ravine
#

i have released 2 games with it

#

i they have a lot of hacks

tardy junco
#

Donno man. I've only used it for simple stuff, but it never produced any bugs for me.

warm stream
#

I don't see the free a* thing you're talking about

fickle ravine
#

downloads here

warm stream
#

just found it

#

ye

fickle ravine
#

had a bit of a learning curve

#

but it is consistent

#

thats why i bought pro

warm stream
#

@tardy junco idk, it doesn't seem like it makes sense. I'm doing step for step the things in this series and literally nothing about it works right https://www.youtube.com/watch?v=aHFSDcEQuzQ

In this video you'll learn what NavMeshes are, how to get the NavMesh Components from the Unity Github (which is what you should be using!), and cover the basics you need to know when setting up your first NavMesh.
We'll also go over:
โšซ How to make Click-to-Move on a NavMesh.
โšซ How to make an Enemy follow a Player on a NavMesh.
โšซ How to ha...

โ–ถ Play video
#

like. I follow verbatim and no luck.

fickle ravine
#

i could get the inbuilt stuff to work

#

but they used to fall through floors and stuff

#

๐Ÿ˜’

#

think that is still a possible bug in grand battle

tardy junco
fickle ravine
#

my main problem was actually swapping between player controller and nav meshed ai

#

that usually when they fell through the floor

tardy junco
#

Navmesh components are not included by default with unity and you need to go to github to get it, which should already make you aware that it's not a completely supported feature.

fickle ravine
#

Really

#

They were inbuilt 2 years ago

#

Before I switched

warm stream
#

It still doesn't make sense that it'd function the way it is imo

tardy junco
#

I bet you just missed something that causes all the issues.

warm stream
#

I've gone through the first three videos three seperate times now, there's absolutely no way.

warm stream
#

@tardy junco Actually if you'd humor me, the videos are like 10-15 a pop. If you wanna give it a go and test my sanity I'd appreciate it lol

#

Cause idk. I feel like a crazy person sometimes

tardy junco
#

I just don't completely understand the issue.

warm stream
#

baking multiple levels and links wouldn't work

#

following the exact instructions in the videos

tardy junco
#

Wanna upload your project somewhere, so that I can also see if I can find a solution?

warm stream
#

Sure I can do that in a bit too

obtuse solar
#

Is there the right place to talk about NavMesh ?

polar shadow
obtuse solar
#

Basically Ive made a procedural dungeon generator

#

I'd like to find a way to bake the nashmesh surface for the whole generated dungeon using code

#

The dungeon is made of prefab rooms

polar shadow
obtuse solar
#

Yeah. Right after the dungeon is generated

wind plinth
#

Guys how do I make the AI go to the nearest patrol point?

tardy junco
#

@obtuse solar did you upload the project somewhere?

#

@wind plinth navMeshAgent.SetDestination

upper ingot
#

@polar shadow to bake at runtime you can add a navmesh obstacle to your object, and programmatialy enable carve, this will rebake the local space of the navmesh that needs to around your object

polar shadow
#

cc: @obtuse solar

hardy sedge
#

how do I make my ai choose a random target between three identical prefabs

#

it only chooses the first in the list right now

obtuse solar
#

I just discovered brackeys made a video about runtime navmesh generation ๐Ÿง™

obtuse solar
#

what are you supposed to put inside SetDestination() ?

#

a position doesnt seem to work

#

can you get a point to aim for with it, without using raycast or any form of hit ?

real sonnet
tardy junco
#

you could sample the navmesh for the closest position on the mesh to be safe

obtuse solar
#

I want my enemy to chase the player once it has triggered a "chasing" state @real sonnet

#

So ive made a raycast that turns the chasing state to true if it hits the player

However I can't seem to update the SetDestination() using player.transform.position

obtuse solar
#
    {
        RaycastHit hit;



        Debug.DrawRay(transform.position, transform.forward * 20, Color.red);

        if (Physics.Raycast(transform.position, transform.forward, out hit, 20) && hit.transform.name == "Player")
        {
            Debug.Log("Player spotted");
            chasePlayer = true;
        }

        if (chasePlayer == true)
        {
            agent.SetDestination(player.transform.position);
        }
        else agent.SetDestination(transform.position);
        
    }```
#

i've checked if the raycast works as intended, the enemy indeed turns into the chasePlayer = true state. But it doesn't move.

player is a reference to my player game oject

real sonnet
#

Wht is player ?

#

Woopsie my phone didnt scroll till the end sorry

#

At first glance I don't see whats wrong

#

(just beware you never set chasePlayer to false ?)

#

If the agent doesnt move, could be something else not correctly setup

#

Did the agent ever move ? Like if you give him some position further away without condition does it work ?

real sonnet
obtuse solar
#

if i set it to hit.point

#

it moves towards me

#

however once i leave the raycast it will stop following me

#

i'll try setting up canChase to false

real sonnet
#

Hum I'm not sure then. Did you debug the player pos ? Maybe the player is on a position the agent cannot reach ?

#

Shooting in the dark here

obtuse solar
#

player.transform.position returns (0.0, -5722.6, 0.0) @real sonnet

#

why is that y coordinate broken

obtuse solar
#

I fixed the coordinates or player.transform.position by correctly assigning my player object. However it still doesn't move

#

when its set to "chasePlayer == true"

real sonnet
#

No clue based on everything you shared

#

Hope someone will have a hint

obtuse solar
#

tweaking my navmesh surface settings and agent made it work.

#

my (i hope) final issue it those little holes in the mesh

obtuse solar
#

also when the enemies aren't chasing me, they arent turning instantly. How can I fix that ?

broken jay
#

Could somebody please tell me why my navmeshes are now baking with treetop areas included in them? I just want the ground level for my navmesh. How can I only use the ground/terrain level of the navmesh and get rid of the rest?

whole parcel
#

Hello, does using the static method NavMesh.CalculatePath have any pre-requistes? Like, do I need to make sure having done something so it works?

#

I'm asking because I'm trying to use it and the path that it returns is always invalid

#

I tried looking for a solution but I can't find anything

#

navMeshAgent.CalculatePath does work though

#

So I don't understand why it wouldn't

whole parcel
#

Or is there anything that could prevent it from working properly?

upper ingot
#

@broken jay maybe you bake it for agents which are higher than your tree tops so they can't get below, and thus the navmesh prevents them to do so

tardy junco
tardy junco
whole parcel
#

Both points are indeed on the navMesh, does the Y axis matter, because the points might be slightly under?

tardy junco
whole parcel
#
 
NavMeshHit hit;

            if (!NavMesh.SamplePosition(origin, out hit, 100, NavMesh.GetAreaFromName("Walkable"))) 
            {
                Debug.Log("no available origin");
                return;
            }

            if (!NavMesh.CalculatePath(hit.position, targetPoint, NavMesh.GetAreaFromName("Walkable"), _path))
            {
                Debug.Log(_path.status.ToString());
                return;
            }
#

This is how I'm trying to use it

#

the code is failing in the SamplePosition that I recently added per your suggestion

tardy junco
#

which of the 2?

whole parcel
#

the origin one

tardy junco
#

Oh lol, there's only one sample position.

whole parcel
#

Yes and it's returning false

tardy junco
#

Try debugging the origin point with a gizmo or a raycast.

#

You're probably feeding in a very wrong position

#

Also try using NavMesh.AllAreas for the mask

whole parcel
#

The origin is the transform.position of a character that is standing on the NavMesh, so I can't imagine how it would be wrong

tardy junco
#

Can you share the part where you get that origin?

whole parcel
#
public class AIPathingManager
{
    private NavMeshPath _path;
    private bool _hasPath;
    public Vector3 currentTarget { get; private set; } = Vector3.zero;
    private Queue<Vector3> _cornerQueue;
    private Vector3 _currentDestination;

    public void CalculateNavMesh(Vector3 origin, Vector3 targetPoint)
    {
        if (!_hasPath || targetPoint != currentTarget)
        {
            NavMeshHit hit;

            if (!NavMesh.SamplePosition(origin, out hit, 100, NavMesh.AllAreas)) 
            {
                Debug.Log("no available origin");
                return;
            }
            _path = new NavMeshPath();
            if (!NavMesh.CalculatePath(hit.position, targetPoint, NavMesh.AllAreas, _path))
            {
                Debug.Log(_path.status.ToString());
                return;
            }

            currentTarget = targetPoint;
            SetupPath();
        }
    }

    public void CancelPath()
    {
        _cornerQueue?.Clear();
        _hasPath = false;
    }
    void SetupPath()
    {
        CancelPath();
        _cornerQueue = new Queue<Vector3>();
        foreach (var corner in _path.corners)
        {
            Debug.Log(corner.ToString());
            _cornerQueue.Enqueue(corner);
        }
        GetNextCorner();
        _hasPath = true;
    }

    private void GetNextCorner()
    {
        if (_cornerQueue.Count > 0)
        {
            _currentDestination = _cornerQueue.Dequeue();
            _hasPath = true;
        }
        else
            _hasPath = false;
    }

    public Vector3 GetDesiredDirection(Vector3 currentPosition)
    {
        if (_hasPath)
        {
            Vector3 dirVector = _currentDestination - currentPosition;
            if(dirVector.magnitude > 0.5f) return dirVector.normalized;
            else
            {
                GetNextCorner();
                return GetDesiredDirection(currentPosition);
            }
        }
        return Vector3.zero;
    }
}
#

Here is the whole class

#

I create an instance of this class in the character that I want to move using NavMesh's pathfinding

#

I call "CalculateNavMesh" to get a new path, and "GetDesiredDirection" to get the direction that I have to take toward the next corner

tardy junco
#

Where do you call CalculateNavMesh? What do you pass in as the origin?

whole parcel
#

I pas as the origin the transform.position of the controlled character

#

I call CalculateNavMesh on FixedUpdate

tardy junco
#

Mind showing that part of code?

#

Try adding a debug ray like that and see where it draws:

if (!NavMesh.SamplePosition(origin, out hit, 100, NavMesh.AllAreas)) 
            {
                Debug.Log("no available origin");
                Debug.DrawRay(origin, Vector3.up * 10f, Color.red, 3f);
                return;
            }
whole parcel
#

Wait

#

With NavMesh.AllAreas I am getting a result

#

Seems that the problem is with GetDesiredDirection somehow, because I'm getting Vector.down as a response

tardy junco
#

Doesn't seem like you set _hasPath to true when you get a new path

whole parcel
#

I do in "SetupPath"

#

Or what do you mean?

tardy junco
#

Nvm

#

That piece of code is pretty messy. And considering it's run every frame we don't know what the hell is going on with it.

#

I'd try putting a lot of debugs everywhere to see how the code executes.

whole parcel
#

Fixed it

#

Didn't know that the first point you get is the origin point

#

Or well, the position in the navMesh under the origin

#

Thanks for the help

obtuse solar
tardy junco
#

well, it looks like you just placed obstacles there

obtuse solar
#

the only thing I have is an invisible enemy spawner

#

it doesnt have the obstacle component

#

or it may be the agent itself... Do I have to bake every frame to cover spaces that were covered by an agent ?

tardy junco
#

The agent shouldn't create holes in the navmesh

#

In case you ticked it as navigation static, you should untick that.

upper ingot
#

hey i'm having a problem for a RTS-like movement of my units. When i click somewhere my units go there and form a nice group which is good (pics below), but when i click somewhere else the group "explodes" and the units lose consistency in the group. I use rigidbody.MoveTowards to move the entities i can't set the velocities directly because units would glitch together. Does anyone know which technic is usually used for group consistency in RTS ?

tardy junco
#

look into boids and flocking steering behavior

fickle ravine
#

thats industry leading RTS pathfinding approach

#

have fun

upper ingot
#

thanks i'll look into your ideas ๐Ÿ™‚

fickle ravine
#

starts at 24:27

#

for the pathfinding

#

๐Ÿ‘

obtuse solar
#

I turned the enemies collider into a trigger as a band aid but I would want those enemies to body block the player without pushing it away

upper ingot
#

nice i already use flow fields

fickle ravine
#

ok well your flow fields need to be modified

#

by the units

#

to prevent clumping

#

you can kind of cheat

#

and modify the flow field by the destination of the units

#

its a trade off, for correct behaviour tho

upper ingot
#

when my units have a direct line of sight on the target position, they just go straight towards it

#

this allows precise positionning

#

and prevents from calculating another flow field

tardy junco
fickle ravine
#

it cant lerp to a node more than grid unit away from it

#

because that will ruin the path finding

#

when you get within the granularity of the flow field you can lerp for smoothness, but thats more an animation thing and is in a different system tbh

upper ingot
#

this issue is my grid squares are pretty huge, and so is the granularity, because i'm calculating the flowfield over a 256 * 256 grid and i need it to be performed on one single frame. Using jobs and burst i got it to take less than 15ms, even less when built

#

i can't really divide it into chuncks since i aim to something like starcraft, where during end game you will completely fill the map with units anyway

fickle ravine
#

no but can more than one unit be in a grid square?

#

because that wont work

upper ingot
#

yes

#

and i can't make them smaller

fickle ravine
#

if you dont want to pull your head out

#

why not

#

do deferred calculations

upper ingot
#

because it will take why more time

#

deferred calculation ?

fickle ravine
#

so

upper ingot
#

you mean non blocking ?

fickle ravine
#

when you click move

#

they move instantly in that direction

#

but they do the flow field calculatiopn

#

in the background

#

on multiple threads

#

definitely dont want your pathfinding to be blocking

upper ingot
#

oh, no can't do that if there is an obstacle in front of them they will take the wrong direction

fickle ravine
#

especially in an RTS

#

so

#

you just need to correct fast enough

#

for it to not look stupid

#

you have like a 10 frame limit

#

even can extend that to 30 frames

#

things dont move that fast

#

even delay the initial move a few frames

#

for the calc

#

starcraft does this

upper ingot
#

yes indeed the issue is choosing the right direction, and that is pretty hard

#

oh i did not know starcraft did this

fickle ravine
#

you can either wait

#

for it to get the right direction

#

or go in the wrong direction

#

and turn around

#

both are fine

#

it wont be the wrong direction most of the time

upper ingot
#

i was waiting for LateUpdate to give it a little more time, but yeah i might need to wait a few frames

fickle ravine
#

yeah definitely dont rely on a frame

#

its complicated but

#

you can do a lot of guess work in between to smooth stuff out

upper ingot
#

maybe i can use the builtin navmesh to choose the direction, they go very fast

fickle ravine
#

that sounds about right

#

use a lower resolution nav mesh

#

to discover direction

#

while you wait for further instructions

#

from the higher resolution one

upper ingot
#

oh that's a way simpler idea

#

i'll juste use bigger granularity then calculate more precisely

#

thanks for the idea

fickle ravine
#

yeah that sounds like what everyone is doing nice

#

๐Ÿ‘Œ

unborn olive
#

I have a kinda large question, but what method do you think games like Monster hunter, dark souls, the witcher, etc... for their boss AI ?

upper ingot
#

they most probably use state machines

unborn olive
#

You know, the usual big monster/creature that "randomly" choose an attack depending of the distance, number of player surrounding them, etc...

#

I also instantly think FSM with some hard coded conditions to choose their next move/attack

#

But I dunno if there are other "common" methods

fickle ravine
#

no because

#

it needs to use random

#

to not be predictiable

#

which is when the host decideds

#

and sends it to everyone else

#

and thats the problem

unborn olive
#

A condition can be randomness

fickle ravine
#

AI is not predictable

#

and you need to SYNC it between everyone in the game

#

that means the host decides what the ai does

#

and everyone else just "plays" it

#

especially because

#

everyone is on a different location

#

on everyones computer

#

so what does the AI use for the position of player 3?

#

it uses the hosts knowledge of player 3 position

#

which was sent across the network

unborn olive
#

Yes

fickle ravine
#

which is why games need to be host dictated

unborn olive
#

Host can be a dedicated server "simulating" the fight I guess ? for MMOs

fickle ravine
#

for mmo

#

they have a seperate server yer

#

that tells everyone what is going on and where everyone is and what spell the monsters used

#

very server heavy

#

dont recommend making mmo

unborn olive
#

Yeah XD

fickle ravine
#

everyone in the world needs to be updated

#

60 players in that world?

unborn olive
#

That's another level

fickle ravine
#

thats a lot of work for that server

#

sending like 40 * 60 packets a second

unborn olive
#

No wonder why it cost so much to keep mmo alive

fickle ravine
#

say they are 1mb packets

#

thats 2.4 gigabytes a second

#

the server is sending

#

not happening

#

they will lower the packet size or the players allowed on that server etc

#

that bandwidth doesnt even exist atm

#

๐Ÿ˜‚

unborn olive
#

They try to do as much as possible client side

fickle ravine
#

think wow is very low rate

#

but even they put a cap on the buffs etc

unborn olive
#

Andd probably only "validate" inputs/outputs from players

fickle ravine
#

yeah its a lot of work

#

super optimized paylaods

#

dont try that at home

unborn olive
#

I won't

fickle ravine
#

will take you a few months to get right

unborn olive
#

few month is generous

fickle ravine
#

i am a generous guy

unborn olive
#

XD

#

And for the AI itself, what type or architecture do you think is used ?

#

Not in MMo

#

In solo/room limited games

#

For this type of bosses (yeah we derived a lot I realize it now XD)

fickle ravine
#

i use like a naughty dog uncharted approach

#

i have state machines compromised of states that are comprised of behaviours

#

and the behaviours are as granular as move to x,y,z

#

so you can do some pretty interesting stuff

obtuse solar
#

well i tried double checking but I don't understand why I still have those holes in

#

when i look at my room in prefab mode i see that little cube in the middle that might be the issue. However I do not know where it comes from

#

okay. My parent "inner walls" object had an obstacle component i forgot to remove... sigh

mighty ocean
#

I am using A* pathfinding for a 2d game, but i am not being able to apply forces to the AI, is there a way i can apply forces to it and make it accelerate?

#

Like, script forces are not working

tardy junco
wind plinth
#

Anyone know why this is happening?

unborn olive
carmine remnant
wind plinth
#

well, it seems like the nav mesh agents, when I hit play, will fly alway

#

I cant change the position back to 0 0 0 cause if I do so they will just continue their journey across the Pacific Ocean by adding another 10k into x y z

fringe steeple
zealous mantle
kindred lily
tardy junco
#

One way you could implement it is by baking the navmesh at runtime.

kindred lily
#

Yes I have researched that but it looks expensive.

tardy junco
#

The area with the grass would not have navmesh, but as you remove the grass, additional area for the updated navmesh frees up and the npc move there.

tardy junco
kindred lily
#

right. So on touch up I have to bake mesh again.

kindred lily
#

I also found this technique. just not sure how to use this with Navmesh Agents
https://www.youtube.com/watch?v=EygJSTL-B-k

The unity package below contains the source code:
https://drive.google.com/open?id=19eiMaUVOx6km7xX82jN0cpkUljsVU3Fq

Please LIKE the video and SUBCRIBE to my channel if you find it useful.
If you discover any bugs, please let me know.

Package with new approach ( I have not implemented attaching colliders yet) : https://drive.google.com/open?id...

โ–ถ Play video
#

and one more. Can we create navmesh links dynamically ?

tardy junco
tardy junco
#

never used them though, so you'll have to research that.

kindred lily
#

cool. Thanks for replying. If something works out I will post here. ๐Ÿ™‚

torn fjord
#

Suppose there are 100 units on one side and another 100 units on the other side of a field, how can I calculate the closest enemy for each of them without lowering the fps too much? I tried to follow some youtube tutorials on them but havent found one that is good. So I tried to use kd-trees and knearest algorithm, but I don't know if that's the right way to do it.
pls I need some advice on this

timid swift
#

you could also run an algorithm on all of them once at the beginning to assign a unit for each to kill if youโ€™re ok with it only killing its assigned unit and no others

dark vessel
#

How can I make people like in GTA vice city people moving at random positions and spawning at random positions
Couldn't even find a good tutorial on YouTube

tardy junco
torn fjord
timid swift
#

have you tried raycasting? that might end up being faster, idk

#

like raycast in a few forward angles every once in a while and pick the closest one but if thereโ€™s nothing, turn the unit a few degrees

kindred lily
# dark vessel How can I make people like in GTA vice city people moving at random positions an...

Place 300 pedestrians in a city in Unity using UMA, Dungeon Architect and some open source code.

Want to give your cities life? This really simple technique will ensure your city is bustling and what's more it won't cost you a penny. Use any assets you already have or use the open source UMA and a simple open source spawner and AI script.

00:...

โ–ถ Play video
cosmic osprey
#

Hey, How do you make NavMeshAgent effected by physics? I added a rigidbody but when he's supposed to stop at certain distance it stars to glitch like jitters and shaky, and also apparently they can't be effected/knocked back by an object launched with AddForce

pliant rampart
cosmic osprey
#

it's in the inspector "Stopping Distance"

kindred lily
kindred lily
torn fjord
timid swift
#

awesome

fallow shore
cosmic osprey
wind plinth
#

anyone have a problem where the AI would just flies away after baking? It's annoying and I dont know how to fix it

#

now it keeps flying up, anyone knows a good alternative to Navmesh? I'm done with Navmesh

clever elm
#

Did you try recreating your scene till the problem appears or disabling stuff till the problem goes away? So you know what causes the problem

arctic pawn
#

How to prevent nav mesh obstacle from pushing entities and only carving?

indigo junco
#

Hello I think this belongs here? im using A star pathfinding for my AI and i wanna be able to set the grid to be local meaning i can easily move it and not have it world space, does anyone know how to do this?

eternal kindle
#

Hi, im doing a my final project for university and was wondering how i should do the AI. Its a grid based tactic game like Front Mission or Final Fantasy Tactics.
The professor told me to investigate the different types of state machines but i only find info about FSM. Are there other types or its okay with FSM?

lucid kayak
#

Hey, I'm pretty new to the Unity AI stuff and could use some help with something.

#

I'm trying to find the point closest to the agent(enemy), but still connected to the player

kindred lily
lucid kayak
#

@kindred lily Thanks, I'll look into it!

lucid kayak
#

@kindred lily Got it working using this! Thanks!

wind plinth
clever elm
#

thats also often a good thing to try

willow vault
tardy junco
willow vault
#

Ah gotcha

#

Yeah I can drag or click the dot but nothing populates

#

Searching by NavMeshSurface on start doesn't assign anything either

#

But the code recognizes the class reference and commands

tardy junco
#

Can you drag it in?

willow vault
#

Nope

#

It lets me drag it on but stays at none

tardy junco
#

are both objects in the scene?

willow vault
#

Yeah

tardy junco
#

You sure about that?

willow vault
#

100%

tardy junco
#

not a prefab?

willow vault
#

Nope

tardy junco
#

And the object you're dragging actually has the NavMeshSurface component?

willow vault
#

Yeah. My suspicion is that I installed the packages in a way that was incorrect but I can't figure that out just yet.

tardy junco
#

Hmmm...

willow vault
#

In order to get the NavMeshSurface code references actually working I had to install the GitHub package

#

But in order to get the rest I had to install the Unity experimental package

#

Now, I did the second one first, and then installed the GitHub package after which actually let me reference navmeshsurface in code

#

So my suspicion is that the GitHub package doesn't recognize the Unity Experimental package NavMeshSurface as being the same

#

And that the Unity package supercedes the Github package's

tardy junco
willow vault
#

Yes, that was the first thing I did

#

But after installing that package, even after using the using UnityEngine.AI include, I could not reference NavMeshSurface in code to bake at runtime

#

It didn't recognize NavMeshSurface as a valid class in code. Only as a component.

tardy junco
#

If both the serialized field and the component on the object are of the same type, it should work.

tardy junco
#

@willow vault if you click the script field on the component(in the inscpector), where does it take you?

willow vault
#

UnityEngine.Ai.Navigation

#

NavMeshSurface.cs

tardy junco
#

and if you go to the implementation in the script with the serialized field?

willow vault
#

Oh I'm starting to see an issue

#

which share types but don't seem crosscompatible

#

the correct one seems to be the second

#

probably because I installed both packages?

tardy junco
#

Perhaps

willow vault
#

I can populate the public variable now, so that seems to have fixed it

#

Thanks for being patient with me haha

#

I'm relatively new to the NavMesh system but I understand it to some extent. In terms of creating smart AI, is it best to use some combination of both NavMesh Agency and AnimationControlled Behavior States to create good AI?

#

In a lot of the research I've done, I've seen three approaches: NavMesh, hard coded states and detection systems, and Behavior States. My assumption is that some combination of all of them will create the smartest enemies with the best animation systems but I don't know if there some "best" approach in Unity.

tardy junco
#

Unity does not have a default "ai" implementation, so you've gotta do it yourself.

willow vault
#

Makes sense

tardy junco
#

If you need a good simple state machine implementation, there's a good tutorial.

willow vault
#

Oh yeah thank you, no worries, I've watched that one before!

#

Just trying to figure out the best practice for my game haha

scenic yacht
#

Hello everyone. I created walk system based Navmesh. So when I click the ground player moves. But also when I click another object that high from ground player moves again

#

Can i ignore the move when clicking this object?

#

I try the obstacle but isometric camera angle is problem for this. I think I need to check if clicked ground or another object. Any help?

#

this is the move script

tardy junco
scenic yacht
#

Umm, is it bake in Inspector window? If yes, i can see blue texture on ground, so works fine. Problem is object higher from ground. Bake wonโ€™t paint when I set obstacle or non walkable ground. But when I click on object player still moves because of camera angle

#

I mean I canโ€™t click non walkable area (bottom of object) because of camera angle

safe basalt
#

how can i make him rotate and try to come to me because he only attacks if im in a straight path with him

raw tiger
#
private void Chase()
    {
        if (!_navMeshAgent.pathPending && _navMeshAgent.remainingDistance <= 2f)
        {
            NavMeshHit hit;
            if (NavMesh.SamplePosition(_targetPlayer.transform.position, out hit, 20f, _navMeshAgent.areaMask))
            {
                _navMeshAgent.SetDestination(hit.position);
                // Set blend tree speed variable
                _animator.SetFloat(_animIDSpeed, _navMeshAgent.velocity.magnitude);
                //Debug.DrawRay(hit.position, Vector3.up, Color.blue, 1.0f);
            }
        }
    }

Hello i follow a tutorial and someone can explain why use SamplePosition and not directly SetDestination for move to the target ?

novel quiver
#

it's for vertical sampling

raw tiger
#

what ?

#

it is for move AI

novel quiver
#

SamplePosition , calculates nearest point without considering obstructions.. you don't really need it just keep , _navMeshAgent.SetDestination

raw tiger
#

obstructions?

tawdry fog
#

Hi there, simple question. Is there a way to make navmeshagents follow a sort of curved path to the destination and turning slightly overtime, rather than turning sharply on the spot and then moving on the path.?

ember warren
#

i am trying to make AI enimies in my game but none of the things i have tried work does anyone have a code i can try

#

plz help

tardy junco
ember warren
#

FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial:
Today I made a quick tutorial about Enemy Ai in Unity, if you have any questions just write a comment, I'll try to answer as many as I can :D

Also, don't forget to subscribe and like if you enjoyed the video! :D
See you next time.

Links:
โžคNavMesh Components: https://github.com/Unity-Technologie...

โ–ถ Play video
#

i dont have the code anymore as i deleted it when it didnt work

ember warren
#

wait i have script

#

i didnt delete it

#

it move or attack the player

#

@tardy junco

tardy junco
#

So what's the issue?

ember warren
#

it dosnt move towards the player even when player is in chase range and when play is is attack range it dosnt do anything so it just dosnt move or do anything at all

ember warren
tardy junco
tawdry fog
tardy junco
tawdry fog
#

Ah okay thank you

#

I think I just need to move the object forward and slowly rotate it to face the target destination, then use SetDestination

novel quiver
novel quiver
rigid shell
#

q

candid nimbus
novel quiver
rancid tide
#

Hey everyone!
Trying to get my navmeshagent to 'Pause' at a destination before continuing to the next destination in my array. But I keep getting the error:

IndexOutOfRangeException: Index was outside the bounds of the array.
NPCMovement1+<GotoNextPoint>d__5.MoveNext () (at Assets/NPCMovement1.cs:35)

Here's my agent code:
https://paste.ofcode.org/ZJ7GUqGEyMKEU7qPBr9Ewz

Any ideas?
Huge thanks!

clever elm
#

array length = 1, destPoint = 0, what will happen?

rancid tide
clever elm
#

most people do length -1 but its kinda the same yea

rancid tide
clever elm
#

yea

rancid tide
# clever elm yea

Thanks! No more errors, but my agent is now having a fit deciding where to move ๐Ÿ˜† onto the next issue!

clever elm
#

one problem at a time ๐Ÿ˜„

glacial crow
#

Delete?

candid nimbus
#

Implement a damage system, when damage > health, destroy(gameObject)

candid nimbus
#

The order of conditions is important.

  "do something else"
else if (inside outer ring)
  "execute an action"
else
  Default behavior```
novel quiver
#

can't help without seeing the code?

alpine glacier
#

but I think I'm just going to rework the code entirely, I realized there's actually no need for circles at all

#

I'm probably just going to rework the game entirely, I don't think the code is good, and I don't want my mistakes to come haunt me

novel quiver
alpine glacier
#

I'll search these up in time, I'm now learning some of the basics tho

novel quiver
alpine glacier
#

Good to know that

#

thanks

tulip ravine
#
    {
        Click();
        Move();
        //Destination();

    }

    void Click()
    {
        if (Input.GetMouseButtonDown(0))
        {
            DaRay = Camera.main.ScreenPointToRay(Input.mousePosition);

            if (Physics.Raycast(DaRay, out Hit, Mathf.Infinity))
            {
                if (Hit.collider.tag == "bldg")
                {
                    MovePos = Hit.collider.transform.position;
                    Debug.DrawRay(DaRay.origin, DaRay.direction, Color.red);
                    Destination();
                }
            }
        }
    }

    void Destination()
    {
        if (Navi.destination != MovePos)
        {
            Navi.destination = MovePos;     //new Vector3(MovePos.x, this.transform.position.y, MovePos.z);
            gameObject.SetActive(true);
            CanMove = true;
            Navi.isStopped = false;
            Debug.Log(Navi.isStopped);
        }
    }
    void Move()
    {
        if (CanMove)
        {
            Navi.isStopped = false;
        }
        else
        {
            Navi.isStopped = true;
        }
    }
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.tag == "bldg")
        {
            CanMove = false;
            gameObject.SetActive(false);
        }
        
    }```
#

So navmesh is pathing but not moving?

#

Any ideas?

floral ivy
#

Iโ€™m currently trying to give my NPCโ€™s a ray casted vision cone, but I am at a loss. Iโ€™ve tried many different methods, but it seems as if it doesnโ€™t work at all or they can always see everything no matter what.

#

If anyone could help me put a working script together, Iโ€™d appreciate it.

#

This is what Iโ€™m trying to achieve but obviously CANT

tardy junco
floral ivy
tardy junco
#

The way I do it usually is either distance check detectable objects each frame and add them to a list inRange or add them OnTriggerEnter with a trigger sphere with a radius equal to visibility range. Then iterate objects inRange every frame or a two and raycast to them. Then add/remove them to/from inView list based on the resulst of the cast. Of course, you'll need to make sure that objects exiting the view range are also removed from the inView list.

analog rose
rustic obsidian
ember warren
#

i made an AI for my game but it dosnt follow the player or attack the player i followed a tutorial as i have never made an AI before and last time i tried it didnt go well here is the code

#

all the enemy does is walk around

#

but dosnt do any of te other stuff like attack or chase the player

#

that is what the script looks like on the enemy

#

all it does is go to the walk points but it dosnt chase or attack the player

#

pls help

#

this is the tutorial i followed

#

FULL 3D ENEMY AI in 6 MINUTES! || Unity Tutorial:
Today I made a quick tutorial about Enemy Ai in Unity, if you have any questions just write a comment, I'll try to answer as many as I can :D

Also, don't forget to subscribe and like if you enjoyed the video! :D
See you next time.

Links:
โžคNavMesh Components: https://github.com/Unity-Technologie...

โ–ถ Play video
#

all it does is patrol

tardy junco
ember warren
#

oh oops

#

fixed that

#

i keep making dumb mistakes like

#

that

#

half of my errors come from spelling mistakes

#

lol

#

srry

#

@tardy junco

rustic obsidian
ember warren
#

ok

ember warren
#

thx

analog rose
ember warren
#

yes

#

i forgot to put the layers in the right configuration

analog rose
#

I watched that same tutorial yesterday and i had the same problem

ember warren
#

ok

#

did u figure it out?

analog rose
#

Do you mind if i ask what exactly you did to fix it?

ember warren
#

sure

analog rose
#

Thank you

ember warren
#

did you do that nav mesh right

#

???

analog rose
#

Yes

ember warren
#

and also did you put the whatisplayer layer in the player and in the scirpt in the enemy

#

??

#

like that

analog rose
#

I added the layers but i didnt touch the script

ember warren
#

srry

#

i meant in there

#

like in that screenshot

analog rose
#

Yes i have it like that

ember warren
#

and do you have the whatisplayer layer on player?

analog rose
#

No

ember warren
#

put it on

#

thats what i did wrong

analog rose
#

Alright thank you so much

ember warren
#

i think

#

tell me if it works

analog rose
#

Ill be working on my game later tonight so ill tell you if it works then

ember warren
#

ok

karmic knoll
#

So I recently watched this GDC talk https://youtu.be/Qq_xX1JCreI?t=1974 about behavior trees and specifically at this point the speaker introduces the idea of using a hybrid system that combines behavior trees (good at providing the directions for a specific behavior) with some other management structure, like a FSM or GOAP, to improve the implementation of AI and the behavior trees by cutting out repetitive trees and providing some closed loop structure when appropriate for the behavior trees. My question is has anyone applied such a system and was it more beneficial for both your programmers and designers as things went on? Would there be a threshold of necessity where you can just get away with a behavior tree before wanting to considering using a hybrid system? I'm really interested in implementing such a hybrid system for some AI I plan on having fireteam/squad behaviors and various combat and idle states.

GDC

In this 2017 GDC talk, Bobby Anguelov, Mika Vehkala, and Ben Weber outline core principles to get the most out of your behavior trees while avoiding common issues.

Register for GDC: https://ubm.io/2yWXW38

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover a rang...

โ–ถ Play video
willow vault
#

Does anyone have a code snippet for generating off-mesh links at runtime?

#

I have a number of libraries I've stumbled across with less-than-stellar documentation and tutorials and am having trouble getting my agents to behave as expected after reworking my runtime baking.

#

The agents are getting stuck on the new surfaces, and not navigating obstacles correctly.

ember warren
#

i have this code for the enemy in my game and it throws a sphere prjectile at you but i was trying to figure out how to make them despawn because the becomes alot of them and they can get laggy how do i make them despawn after like 20 seconds or somethin

#

here is code

#

or here

#

pls help

#

how do i make the projectiles depspawn

tardy junco
ember warren
#

the projectiles

tardy junco
#

They should get destroyed after 5 sec according to the code.

ember warren
#

it is wierd though they dont

tardy junco
#

Are you disabling the script or something?

ember warren
#

no

#

as it is in the enemy script and the enemy still walks around and stuff

tardy junco
#

Ah, it should be Destroy(rb.gameObject, 5f)

ember warren
#

oh

#

oops

tardy junco
#

Was that part in the tutorial?

ember warren
#

thx

#

no

#

you are very helpfull

#

thx

tardy junco
#

Because atm you're destroying the prefab

#

Trying to

ember warren
#

the tutorial didnt even have despawning but there was so many i needed to try find out how

tardy junco
#

Do some beginner tutorials on unity learn. You seem to be missing some basics. Doing random tutorials on YouTube is not gonna help.

#

They assume you already have these basics.

ember warren
#

ok

#

thx

sonic rain
# karmic knoll So I recently watched this GDC talk https://youtu.be/Qq_xX1JCreI?t=1974 about be...

@karmic knoll Hey! I did not try implementing such idea myself, but I plan to do it next year, probably
Regardless of that, there is an article on GameAIPro about Final Fantasy XV, which did Behaviour Trees + FSM. I'm sending it here in case you didn't have a look yet:
http://www.gameaipro.com/GameAIPro3/GameAIPro3_Chapter11_A_Character_Decision-Making_System_for_FINAL_FANTASY_XV_by_Combining_Behavior_Trees_and_State_Machines.pdf

lucid kayak
#

Hey, I'm struggling with an AI concept right now, if anybody can help I'd greatly appreciate it.

#

Blue represents navmesh and red equals walls

#

My AI can jump between navmesh areas

#

Now my issue is I need to have the enemy jump to the edge across rather than the one closest to the player

#

Because right now they get stuck

torpid stump
#

did you try using NavMeshLink?

candid nimbus
torpid stump
#

He wants them to jump to the end of the straight-down arrow on the left, but they keep jumping to the end of the diagonal arrow and get stuck on the wall, if I understood correctly
I believe NavMeshLink is the way to go

lucid kayak
#

Is it possible to make them jump from the start of the navy mesh link and then land at the end rather than walking over it?

willow vault
#

Anyone have experience with using Prefab objects with NavMeshSurfaces on them?

#

I'm instantiating a "Room" for my procedural generation, the prefab for which I have pre-baked

#

I then spawn the enemies and activate their agents on top of that surface

#

However, after moving to this method, the AI stopped working properly and no longer detects my player, and the navmeshsurface seems to be baking invisible geometry

#

this is how it looks in prefab view (cannot view NavMeshSurface)

#

and here's what shows up in the main scene when I instantiate

#

(the inside of the box)

#

What in the heck are those big blue planes out there?

modest ingot
#

can i change walkable area clamp ? i mean like in the picture

modest ingot
#

also why those agents tryin this instead of using crosswalks from anotherwhere

modest ingot
young river
#

Hello i'm new to Unity, me and a friend are working on remaking pacman from scratch as a challenge. I'm using A* as an AI. I have the A* scripts all apart of the Enemy Parent object. What i need help with is keeping the rotation of the child object "straight." In this video the Pac Man turns upside down at times. Tried looking through the internet for solutions but couldn't really find one that worked for me.

young river
#

til all about Eulers, and transform.Rotate and transform.localeulerangles
and i learned what i was doing wrong!

jaunty raft
# karmic knoll So I recently watched this GDC talk https://youtu.be/Qq_xX1JCreI?t=1974 about be...

Any system that is dogmatic about its abstraction (i.e. a pure BT) will eventually run into complexities when the (part of the) problem doesn't fit the abstraction. A good BT implementation will allow you to insert FSMs and arbitrary code ad hoc to fix/circumnavigate such inefficiencies. These can be black boxes with project specifix semantics that designers can use just like select/sequence/monitor/...

lapis hamlet
#

I wanted to make a topdown shooter with car ais similar to what the first gtas were, for the civilian ai I've got everything working but I can't get the cars working for the love of me.
Can't find how they originally did it either so if you guys have any info or insight on that i'm taking it

tardy junco
lapis hamlet
tardy junco
# lapis hamlet haha

If you want to use the navmesh with vehicles(vehicle colliders), you'd need to write a custom agent, that will control the vehicle based on the path, instead of controlling the transform directly.

lapis hamlet
#

I tried doing that to no avail, handling the turning and especially trying to correct after a crash/getting of course was a nightmare.
Also placing nodes for every lane that a car can take is pretty exhausting so i wondered if there were other methods

#

maybe a navmesh could be enough, is there something special for vehicles ?

shrewd quartz
#

Hello guys. I tried to create a shooter ai buh it was a dead end for me

alpine glacier
#

hey guys i was just making enemy follow the player(the capsule) and i set animations and scripts and this happened. enemy keeps running in a spot but i wanna make it play idle animation when it stops help me please.

#

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

public class ai : MonoBehaviour
{
// Start is called before the first frame update

public Transform target;
private NavMeshAgent nav;
private Animator animator;
void Start()
{
    nav = GetComponent<NavMeshAgent>();
    animator = GetComponent<Animator>();
}

// Update is called once per frame
void Update()
{
    nav.destination = target.position;
    animator.SetFloat("Speed", nav.velocity.magnitude);
}

}

candid nimbus
alpine glacier
candid nimbus
alpine glacier
alpine glacier
candid nimbus
#

Seems like that should be correct. The agent may return speeds that are non zero but close to zero. So if you're in that blend it should probably be close to Scene. Have you tested it against blend values near zero? Or is there any states outside this that may be doing something?

alpine glacier
#

i was just working with the wrong animations :///

foggy heron
#

A question regarding the Navmeshagent: Is there a way to make it drift less past corners?

#

So it always kind of walks in a straight path from corner to corner

#

It often overshoots around corners which isnt what I want

#

Ok turns out I just had to bump up the acceleration a ton

glossy sundial
#

sup everyone!

glossy sundial
#

I have been doing a lot of reading and I feel rather torn. I am new to unity and I need to make AI.. I was thinking I do simple patrol from point A to B and if the player is close enough enemy will attack the player.I then started reading up around UtilityAI but I can't find solid working examples.

What are your thought about AI? Should I try and implement Utility as a newbie or should I just stick to simple a to b

tardy junco
#

It doesn't sound like you need a complex system like that for just 2 states.

#

In fact state machines and behavior trees might be an overkill already.

glossy sundial
#

I would like to have AI that would walk about, chase and attack player, run if damaged enough and self heal..

#

with that said

#

the more simpler AI I will start with but I will research state machines.

fringe crag
#

Hoped to get people's thoughts on this. My game involves base building-ish mechanics. you can build platforms, and stairs leading up to higher platforms. these platforms are 100% user placed. I'm currently using the component based navmesh system, and upon exiting "construction mode" calling rebuild mesh if any structures changed.

#

as the scene gets more complex the little "hitch" of rebuild can be pretty noticeable, especially when i set my voxel size to production quality

#

i was hoping i'd be able to precompute navmeshes for platforms and stairs pre-build and seamlessly just place them, but agents don't know how to traverse the separate surfaces without navmesh links

#

anyone have thoughts on how to optimize / rethink the way i'm handling this situation?

#

Also i've asked this many weeks ago, but NavMesh.CalculatePath() just does not work with component based navmesh system. Always returns false. ๐Ÿ˜ข y tho

candid nimbus
#

Not necessarily targeted help here, but when the situation is changing that dynamically I find a regular grid based nav mesh is easier to deal with. It's not compatible with unitys stuff but there are some solutions (also a* on grids is pretty straight forward)

fringe crag
#

normally i would agree, players also have the ability to decorate with oddly shaped decorations

#

so doing broad collision detection is pretty important too

fringe crag
#

i might have to break up each "floor" into it's own navmeshsurface and make stair objects navmeshlinks. might help break up the recalculations

dire perch
#

Newbie here to most things game development especially AI and coding. I'm working on a small game with wave based enemies. The idea is that enemies spawn in a room with two exits and use either one. They travel a short distance before settling on a random spot in front of the player and attacking from there. They never attack the enemy in close-quarters.

#

I've used the tower-defense tutorial by Brackeys, but it didn't work the way I hoped.

viral palm
#

I have code that adds a story to a building. that story has a navmesh. the 5 first stories prefab have their navmesh, but after that all the other stories prefab dont get the navmesh. any ideas why and how to fix pretty please? ๐Ÿ˜„

spark marlin
#

Hey, so I've got a scene where I have an opening in a wall. After baking the navmesh, the opening is unable to be walked through, any ideas why this is?

tardy junco
spark marlin
#

haha, thanks for that got it now ๐Ÿคฆโ€โ™‚๏ธ

alpine glacier
#

do i only need C# to make an mlai?
cause most tutorials uses both C# and python

molten sequoia
#

Python is just used for the tools. You don't need to write python.

alpine glacier
#

can somebody help me with how to setup an navmeshquery filter area mask?

#

i tried this: public int areamask = 4<<6; public UnityEngine.AI.NavMeshQueryFilter filter;

#

then apply the areamask to the filter an then make use of the filter within the UnityEngine.AI.NavMesh.SamplePosition- function

#

i also created a "new filter"if the samplePosition function was called, but its not working

#

i only can use 1, or large values like 320 (areamask)to get positions

alpine glacier
#

i dont want to sample other areamasks, just 4 till 6

alpine glacier
# alpine glacier can somebody help me with how to setup an navmeshquery filter area mask?

โœ… Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=uDYE3RFMNzk
Let's look at Layers and Bitmasks to see how they work. We can manipulate Physics interactions and what a Camera sees.

If you have any questions post them in the comments and I'll do my best to answer them.

๐Ÿ”” Subscribe for more Unity Tutorials https://...

โ–ถ Play video
#

you need to setup areas

#

and then connect the objects to the areas-> navigation static

#

go to the objects tab and then select a gameobject to set the desired navmesh area

#

NAVIGATION STATIC MEANS IT GETS BAKED

lucid kayak
#

I'm having an issue with Unity NavMesh, can somebody please help me?
An agent is supposed to get as close as they can to their destination if it's on a disconnected part of the navmesh.
And it works properly when the platform the agent is on is small in size like this.

#

Hold on, making another diagram

#

But when the plane the agent is on is large in size, the agent just completely freezes up if it can't reach the destination

#

It's causing some real issues on certain maps in my game and I have no clue how to fix this

#

All the code is doing is setting the destination of the agent

lucid kayak
#

?

alpine glacier
#

something in your script is messy, or your agent is baked in a wrong wa<

#

y

#

@lucid kayak show your controller

lucid kayak
#

Let me make the simplest script I possibly can and see if it still happens

alpine glacier
#

reproduce is always the best approach

lucid kayak
#

I have determined it is caused by setting destination every frame

#

If I want to make an agent follow something that moves, how should I set this up if I can't set the destination every frame?

lucid kayak
#

I don't see anything about this mentioned in any documentation, so I'm pretty lost on how to progress from here

#

The agent essentially rotates a bit before moving to the destination

#

This wouldn't be that big of an issue if it SetDestination wasn't being called frequently, but since this agent is supposed to be following the player, it basically never moves

#

since SetDestination, in my case, is called every 5 frames

crimson bay
#

I'm making a turn-based ai system, but I dont know how to begin. Any leads are helpful

alpine glacier
#

but its working for me without extra work

alpine glacier
molten sequoia
# alpine glacier i am not sure i understand

Unity uses a lot of existing tools for training, which are commonly managed with python. You need to have python environment for running the tools, but defining how rewards are handled and control over training sessions is scripted in Unity with C#.

#

Installation guides go through the steps to setup the python environment

upbeat vale
#

Can anyone point me at some good open source AI frameworks? Ideally something optimized for 3d navigation / object avoidance? Bonus points for one that doesn't require custom monobehaviors be assigned to each world object in the scene. Something similar to this ideally: https://www.youtube.com/watch?v=cWiKMl7blgw

jolly falcon
#

Does anyone knows an asset for Unity for HD Earth rendering usable from a Space point of view? I've seen a lot of really cool assets for "ground to sky" images, but I need a "space to ground" point of view. I need it to create a dataset generation pipeline for an AI algorithm that does cloud detection

clear stag
#

i checked the navmesh already if there are any bumps or something but that doesnt seem to be the case

alpine glacier
#

bake is greyed out on my terrain

#

ups i was in playmode... ๐Ÿ˜ณ

noble fog
#

@dense sparrow Is there a reason you are cross posting these?

rain hound
#

hey so im having a issue to where unity wont bake a navmesh on to my custom table

#

It is set to static

rain hound
dense sparrow
earnest forge
#

the solution was to disable auto braking

#

not sure if it applies whatsoever to your situation

#

but who knows

eternal tapir
#

Anyone know or have a tutorial on how I can have an AI in a Driving vehicle?

jaunty raft
real sonnet
#

Google as a lot to say about that, I'm sure

lucid kayak
#

Alright, I've asked for help on this time and time again, and in multiple servers, I genuinely don't know what to do anymore and I'm about to completely give up on this.
Unity's NavMesh has been giving me so many issues that I'm about to just write my own solution, but I'd still rather avoid that if possible.
Right now, I'm having an issue where agents will rotate before moving, but only under specific circumstances (when standing on an unreachable part of the navmesh, or after warping the agent).
Please help, I'm completely stuck at this moment and members of my team are waiting on me.
https://youtu.be/3J5O2SZpaB0
As you can see in this video, the cube (being an agent) is fine following the player normally, but as soon as I jump up onto the other platform, it starts looking back every time I set it's destination to the player.

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

public class Test : MonoBehaviour
{
    NavMeshAgent agent;

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

    void Update()
    {
        if(Input.GetKey("e") && !agent.pathPending)
        {
            agent.destination = new Vector3(Player.localPlayer.transform.position.x, transform.position.y, Player.localPlayer.transform.position.z);
        }
    }
}

I made a script as simple as I possibly could to make sure if it was my enemy component's fault
It still happens

#

This is what the navmesh looks like

molten sequoia
#

@lucid kayak It's not terribly uncommon to write your own navmesh agent while continuing to use the pathfinding implementation of Unity.

lucid kayak
#

@molten sequoia Biggest hurdle here is the lack of an async calculate path function

late ocean
rain hound
#

Hey, I'm currently developing a VR Colony type game. (think Rimworld, but with VR capabilities) I'm currently trying to figure out the AI. I'm not going in depth as Rimworld, but you can assign each human one job. (EX: Lumberjack - chops wood and then carries the wood to storage) If anybody could point me in the right direction or recommend a asset please let me know!

native dome
#

Hey everyone, does anyone know if its possible to have a NavMeshAgent run in edit mode? I want to have one navigate by pressing a button on a custom editor (while the game is not running)

I'm getting the following error when calling setDestination()

SetDestination" can only be called on an active agent that has been placed on a NavMesh.
The agent works fine when the game is running

molten sequoia
#

Probably can't use NavMeshAgent. I would try the experimental API as linked above and replicating the needed NavMeshAgent functionality.

#

No idea if it actually works though

native dome
#

Thanks

dusty nova
#

Can someone point me to a visual editor for behaviour trees, preferably integrated into the Engine??

gray laurel
#

Hi guys ๐Ÿ™‚ Im making a 3D (top view) racing game and now Im trying to add some bot cars. For the AI, should I use ML-Agents try to implement my own AI?

woeful basalt
#

So i put the NavMeshAgent on my player object, and NavMeshObstacle on a rotated cube like on the image below, and then i pressed "Bake" in the Navigation tab. The navigation mesh looks correct, and my player follows it perfectly on the terrain, but not on the cube. It just stops or weirds out whenever it's nears the edge of the cube.
Anyone know how to make my player walk up the cube correctly?

vast viper
#

Is there a workaround or trick to make ai pathfind underwater, or flying?

timid swift
vast viper
#

I can handle the movement handling when underwater
Just the pathfinding part that im not sure
Can navmesh be used underwater? Like an underwater tunnel for example

#

I guess what would work is a waypoint type graph. But im already using navmesh
Unless mixing graph type is a thing?

dusty nova
#

Are there any good free behavior trees out there?

vast viper
#

PandaBT

dusty nova
#

@vast viper does that one have a visual editor?

vast viper
vast viper
dusty nova
#

yeah, node based

#

@vast viper any reason why you recommend Panda though?

vast viper
#

Just bcoz i'm using it

#

I never tried any node based BT tbh, but visualization wise i'm fine with text based like this

#

I'm a coder, so
I don't like node based coding so i thought why would i like node based BT if there's a text based/indent style

dusty nova
#

sure, I get your reasoning

dusty nova
#

@vast viper ended up using this:

#

Get this free behaviour tree editor asset for Unity by following the link:

๐Ÿ”— https://thekiwicoder.com/behaviour-tree-editor/

Support this channel:
๐Ÿ™ https://www.patreon.com/thekiwicoder

Previous Behaviour Tree Videos:
โ–ถ๏ธ Behaviour Trees using Graph Builder (Part 1)
https://youtu.be/nKpM98I7PeM

โ–ถ๏ธ Behaviour Tree Editor Styling using USS style...

โ–ถ Play video
#

which seems to be working great ๐Ÿ˜„

vast viper
#

Looks good
I might give that a try too

dusty nova
#

I had to modify the code a bit to be able to work for my 2D project, but other than that I'm currently happy with it

clever coral
#

Kinda a shot in the dark here but I'm trying to set up the Polarith AI "Perception Pipeline" and my dropdown menus are not populated like in the documentation, if anybody knows what I've done wrong it'd be greatly appreciated

clever coral
#

I figured it out so I guess ill post the solution forum style. if you leave the AIM environment labels blank it makes them unselectable in the dropdown so a name is required.

spice jetty
#

Hello. I think, questions about Navmesh go here, right?

#

I have a terrain and road going over it. I try to bake navmesh for a road, but I don't want my agents venture off it

#

In some places when terrain gets close to road I get artifacts like this

#

what's wrong?

#

How do I specify Navmesh generator to use only that Road object?

#

Road is defined as single object

#

Ah.

#

I get it

#

I removed Navigation Static checkmark from Terrain

#

I have added it to Road and specified it as walkable

gray laurel
#

for a racing game, should I train the same AI (using ML-Agents) on different tracks?

spice jetty
#

how do you think, will my agent get past roadblocks?

real light
#

Question do i need linked lists to make an adjacency list or can i use regular lists

regal ingot
#

@wraith basin To answer your question. I have used BehaviorDesigner in the past but plan on using NodeCanvas in my current project.

wraith basin
#

I should probably clarify that I've done a fair amount of research on this by now and only decided to ask because none of the solutions I found actually fit my purposes.

#

the simplest and most prominent one that I keep running across is the "unity tanks" thing

regal ingot
#

(Glad to hear you already did research before asking!)

wraith basin
#

basically how bad of an idea would it be to reflectively grab each behavior's name when scripts are compiled and use those as options in a dropdown for a MonoBehavior

#

i 100% overcomplicated things trying to explain LOL

#

that's on me though, i'm stressed and burned out working on like 6 projects simultaneously

#

brain mush

regal ingot
wraith basin
#

nobody fucking told me that TypeCache was a thing before now holy shit

#

you're a lifesaver, i've been doing that shit manually

#

i'm gonna cry lmao

#

I work with reflection almost constantly (for an unrelated work project) and it's even worse than Python

regal ingot
wraith basin
#

i'm gonna look into BehaviorDesigner and NodeCanvas rq since you mentioned them

#

on name alone, NodeCanvas sounds like something I could use

#

yeah, these both look solid, but I'm broke

regal ingot
wraith basin
#

for context I'm in college and don't get paid enough

#

Yeah, NodeCanvas looks much nicer and it seems more flexible

#

supports dialogue trees as well as behaviors

desert harbor
#

Any ideas on how make a flying AI with root motion? I have issues getting the model to move on the y axis

#

For context, itโ€™s an animal flying.

final sleet
#

Probably both your script and rootmotion are overriding each other. Make sure you're using lateupdate, you might need to set the script order.

#

If you don't need the rootmotion y value, just set your own. If you do, then you will need to read it out so you can check what point in the animation you're at and add the right amount to your value.

#

... or you could just make new animations of it flying up and down, and blend those in so rootmotion can control the vertical height.

desert harbor
#

Sorry to ask, but how come I would do that on the late update? Also, I am using the Kiwi coders blend tree add on, and it doesnโ€™t use monobrhavior

#

For now, Iโ€™ll try getting a blend going, thanks

plain owl
#

Hey, so how would i go with creating a AI for driving that track? Most turtorials ive seen have used the waypoints but in my case i dont think they will be helpfull as there are randomly generated obstacles (see images). The obstacles could be generated in any form. Now how should i implement smart driving for the car?

dark sphinx
#

2D or 3D?

fleet cradle
#

Maybe try pathfinding?

alpine glacier
#

Just make a path that they always follow

crimson oxide
#

Hi is there a way to generate a grid of points on a navmesh surface?

plain owl
plain owl
dark sphinx
#

Is the path always the same?

#

If it is, you can put multiple waypoints across the breadth of the track

#

Is that a word?

#

Anyways and then disable waypoint is theyโ€™re inside an obstacle

fringe sky
#

Does anyone use Astar Pathfinding project Pro?

plain owl
#

Makes sense

ember warren
#

I am having a problem with The ai script i usecan anyone help the ai just looks in the direction it originally saw the player when the player enters the attack range can anyone help? https://hastepaste.com/view/COTakWfvpt

#

here is problem

#

can anyone help?

#

it works in one of my levels but not in the others

#

also it dosnt chase the player

tardy junco
#

I see sausages and tomatoes. Where are the enemies?

ember warren
ember warren
#

they only look that way

ember warren
#

never mind i fixed

viscid tulip
#

Ok imma start using ai guys but I am wondering what is the best way to hold previous information. So my character tells the ai my name is โ€œsosoโ€ then next time I play it will know my name. I do not want to use player prefs at all just wondering where to save this info. I basically wanna evolve the ai. I worked with ai a bit but not in unity so ๐Ÿค”

tardy junco
low swan
#

Hi everyone, I need a bit of help. I'm using navMeshAgent.CalculatePath to see if an agent can go there without any issue and to get the resulted path for making a "navigator". The problem is that CalculatePath is returing true even if it's impossible that he can go to destination, even if destination if very far away from last path point.

I can check the status to be NavMeshPathStatus.PathPartial but the world I'm working on is pretty big, so sometimes the status is partial even if he can move there.

So my biggest problem is that status of path is partial if the destination is impossible or if the destination is far away. How can I check if destination is not reachable?

alpine glacier
#

its assigns the enemy

#

although plays the animation but stays still

humble trench
#

Hello! Does anyone have any suggestions for tools/workflows to clean up navmeshes of all the unwanted/small/detached islands, without having to go and manually change every renderer? (not to mention the renderers that cannot be changed because they are merged with ones that need to be walkable)

tardy junco
swift summit
#
 void Start()
    {
        ai = Instantiate(obj, spawnPos, Quaternion.identity).GetComponent<AI>();
        ai.SetupAI();
        ai2 = Instantiate(obj, spawnPos, Quaternion.identity).GetComponent<AI>();
        ai2.SetupAI();
    }
    bool frame = false;
    private void Update()
    {
        if (!frame)
        {
            ai2.gens = ai.gens;
            ai2.neurons = ai.neurons;
            ai2.Mutate();
            frame = true;
        }
    }

and my AIs have a same path, but idk how it happens cause ai2 is mutating and it may have dif gens than first ai, but if i'll look in inspector first ai have same gens and neurons with second ai idk how it's working

humble trench
blazing oar
#

anyone know some 2d animal ai?

scarlet pollen
blazing oar
#

no nothing

blazing oar
small hearth
#

what do you want it to do? wander? chase? run from predators?

blazing oar
small hearth
#

i'll see if i have one

small hearth
#

is 3d, but easily translateable to 2d

#

anyone know how to update the centre of a graph in a star pathfinding?

drifting token
#

Is there a way to partially regenerate a NavMesh? I want to be able to create obstacles at runtime, but I dont wanna fully regenerate my navmesh, only the area where I created an obstacle

tardy junco
drifting token
tardy junco
#

Should be relatively fast. How many obstacles do you create/remove every frame?

drifting token
#

Probably < 1? Player should be building most things per hand, enemys will also be able to build, but certainly < 1

tardy junco
#

Then it's not a big deal