#๐Ÿค–โ”ƒai-navigation

1 messages ยท Page 13 of 1

drifting token
#

And removing them would stitch the navmesh back up right?

tardy junco
#

yes

drifting token
# tardy junco yes

Okay. Is it possible to split a navmesh in chunks for perfomance? My world would be relatively big (maybe procedurally generated aswell) so i wonder if having 1 big navmesh for that would be problematic

tardy junco
#

should probably use the navmesh components preview package then. You can generate a navmesh around the character at runtime.

brave steppe
#

I have an agent that should walk on my nav mesh. It starts to walk but walks out of bounds of the nav mesh. How can I handle this situation?

brave steppe
#

Anyone?

crimson oxide
brave steppe
brave steppe
#

Honestly what I want to know is how can I detect if the AI is stuck outside of my navmesh and then how should I send him back?

drifting token
#

I have a patrol system, which consists of a chain of points, and everytime my agent reaches a point it gets send to the next one. The problem is, when I have multiple agents, and they arrive on the same spot at around the same time, they clump together trying to reach the spot, resulting in none of them reaching it.

How would I avoid this?

orchid marsh
#

Probably both

drifting token
orchid marsh
#

How do you handle your points? Are they objects?

drifting token
orchid marsh
#

I dont recommend using separate variables, make a list instead

#

or array if you wish

drifting token
#

I plan on doing that, its just for testing atm, in the end those patrolpoints will be created dynamically

orchid marsh
#

and hardcoding positions is not the best idea

#

I suppose you can add a bool property to PatrolPoint class that tells if its occupied

drifting token
#

Maybe I can make a sort of queue, that makes them stop like ~1,5 times their own size infront of an occupied point

orchid marsh
#

thats also an option

drifting token
#

and if that spot is already beeing queued, just make it ~3 times their size

real sonnet
brave steppe
#

@real sonnet thanks ๐Ÿ™‚ I've solved it now. What I did is check every 2 secs if its stuck/same position then I just set a new path.

peak blaze
#

Hi everyone can anyone help me how to make Friendly Allies AI??

pulsar jewel
#

Hello, I am using A* Pathfinding and I have a left idle and walk animation on an enemy. I have it tracking the main player, and it auto flips left and right, but for some reason the idle doesn't flip. Does anyone know where the code for the flipping resides?

#

2d game btw

#

I can see the scale X is changing from a 1 to a -1 whenever it flips. When going right it walks and idles at 1. But when going left it walks at -1 but idles at 1

#

I have no idea why it's happening

pulsar jewel
#

Also, I have no scripts on the GFX for the enemy. So I assume the A* Pathfinding is handling the flipping?

#

The GFX has just an animator on it

jagged anvil
pulsar jewel
#

Basically I am not sure what's controlling the flipping of the GFX

#

I have an idle left and a walk left animation

#

the walk is flipping perfectly fine

#

while the idle is just always facing right

#

It doesn't make sense

#

I deleted the animator, re added it with just the idle, when It's tracking it's facing the target correctly. But when it stops it's always facing right.

jagged anvil
#

I think that this is more of a 2d question than an AI question. But while I understand what you're asking about there's undoubtedly something that u need to troubleshoot. If you're using an A* asset from a third party you might ask their support.

#

I don't use Unity's animators for anything so it's not something that I can answer

pulsar jewel
#

I think it's most definitely a problem with the AI scripts.

#

The animator otherwise is pretty straight forward, you put in a left animation and that's just how it is. For some reason, the GFX is getting flipped automatically depending on where it's target is. But, it has inconsistencies and I can't figure out why.

alpine glacier
#

How do I generate 2d ai which increase its spead and rotation speed time by time between minimum ai and max ai count ? Can someone help me ? (The ai code has a public float spead and public float rotation speed)

real light
#

Ive mostly seen A* examples use grids for their implementation is it possible to use A* without the reliance of grids?

stone owl
#

Failed to create agent because it is not close enough to the NavMesh
I am literally using SamplePosition to get a point on the navmesh to spawn the AI, which it aligns perfectly to the navmesh but is disconnected from it somehow.. what can I do ?

#

.. Really? This is the solution for spawning an AI? happens to be a very common thing in games, can't imagine this is what everyone has to do ๐Ÿค”

weary pewter
#

Hey, I'm going to start working on a rudimentary AI that rotates to follow a player. Would there be any function that can detect and track the player, either through a camera or something else?

#

For context, it's a space flying game so there's no navmesh I can use

stone owl
#

look into AI steering

#

@weary pewter

earnest coyote
#

Hello i have a scene which run at 50 FPS but when i add NPC to my game it getting worse

#

with 50 npc which just wander around in scene with custom controller i get 25 FPS drop

#

so is there any solution on unity asset store which i can use for characters?

#

i want to add as many characters to game

real sonnet
#

Sure you could search the asset store for low footprint wandering AIs for your NPCs

#

OR use the Profiler to fix the heavy performance load step by step

earnest coyote
#

any specific asset in mind?

real sonnet
#

I don't. I don't know each asset on the store, and one might be better suited to your project than another. Your call really ๐Ÿ˜‰

frank wasp
#

Hello i have a question. How can i find the distance to player using A* pathfinding. A* pathfinding creates a line/path to a player and it cant ignore obstacle and base of it it creates a path to find the player and i want to messure it

regal ingot
frank wasp
#

ok ty

autumn widget
#

Hi, I don't know if I need to use a* path finding or nav mesh from Unity

#

It's a 2D project when the world is divided in "squares" and I have a 2D array where I have all the positions of the player

zealous mantle
#

If it's a grid, then use A* (or some other tile based algorithm).

autumn widget
#

okay thank you

jaunty raft
heavy spindle
#

When I set an object to be Navigation Static, does Unity use the object's mesh, or the colliders you've defined for the object to calculate the navmesh? I have a lot of small trees with thin capsules for the trunks but it seems like the navmesh is taking the whole mesh into account in spite of the trees not having mesh collider on them.

tardy junco
unborn olive
#

But I'm facing an issue with this approach : since actions (like Patrol) are assets, anything they store will be shared between all AI using the same action. That's why they store any datas that could change in the StateController of the AI (what I called Brain in my project).

#

Which is...

#

Strange because the Brain will have to store a lot of values if the FSM starts to grow. Lots of these values will not even be used by the AI. Like why would I store a "currentDirection" in an AI that can't even move ?

#

I tried an object based FSM in another project, but I hate it since my transition are stored in the states which means I have a LOT of c# files to manage, in the SO approach I only have to create a lot of StateSO for each different AI which is fine, but I lose the fact that each action and transition is an instance of an object and thus can store temporary datas.

#

I know you can use CreateInstance of a ScriptableObject, but it feels hacky and not the way SO where supposed to be used.

#

But is there any other way to represent states/actions/transitions than either plain class, SO or GO components ?

real light
tribal agate
# unborn olive I know you can use CreateInstance of a ScriptableObject, but it feels hacky and ...

I disagree with using CreateInstance being hacky, but you can certainly achieve very similar functionality by storing the logic on a SO, storing the data on a plain C# class that you create an instance of for each AI entity, and passing that data into the logic. You need to store the data somewhere.

With your example of the "currentDirection" not being needed for an AI that can't move, that seems like a problem that either interfaces or components could solve well.

Very roughly:

public abstract class FMSAction<T> : ScriptableObject where T : IFSMData
{
  public abstract void Update(T data);
}

public interface IFSMData { }

public interface IFSMMoverData : IFMSData 
{
  Vector3 CurrentLookDirection { get; }
  float MoveSpeed { get; }
}

public class FSMMoveAction : FSMAction<IMoverData>
{
  public override void Update(IMoverData moverData)
  {
    // do movement
  }
}

public interface IFMSAttackerData : IFMSData
{
  Vector3 CurrentLookDirection { get;}
  float AttackSpeed { get; }
}

public FSMAttackAction : FSMAction<IAttackerData> 
{
  public override void Update(IAttackerData attackerData)
  {
    // do attack
  }
}

// your actual AI actor fills this in and passes it to the FSM
public class FMSMoverAttackerData : IMoverData, IAttackerData
{
  public Vector3 CurrentLookDirection {get; set;}
  public float MoveSpeed {get; set;}
  public float AttackSpeed {get;set;}
}
unborn olive
# tribal agate I disagree with using CreateInstance being hacky, but you can certainly achieve ...

So if I understand correctly, you think that any instance specific data should be stored in a component of the AI (like the Brain component), with maybe using interfaces for optional data. In the unity lesson that I heavily based my implementation on, they store all instance specific data in the StateController (like current target, current waypoint, etc...) and the Actions that actually need these info simply retrieve them so I guess it's close to what you are saying.

#

(Sorry for the late answer)

lone ore
#

does anyone know a tutorial or something on 2d topdown pathfinding? i checked out a* but since my game has a mix of non tilemap objects and tilemap objects it didnt work

woven cipher
#

i have a question. Does anyone know how i can make an ai follow the player (the enemy should have gravity, so i wont use the brackeys video, the enemy should also jump if it needs to.)

woven cipher
orchid marsh
#

Have you tried googling this specific problem

#

"unity 2d pathfinding with gravity"

thick flicker
#

lol

haughty osprey
#

username checks out

sour shard
#

is there any way I could get the NavMesh GameObject that the NavMeshAgent is currently on?

stone owl
nocturne quartz
#

Is anyone interested in helping me with an AI game? I already have an idea, itโ€™s for a school project of mine, please DM me. ๐Ÿ˜„

tardy junco
nocturne quartz
tardy junco
nocturne quartz
#

Alright thanks

leaden willow
#

can anyone please tell me how to make a plane block the NavMesh?

#

the case is an island with a sea around it

#

the submerged parts of the island should not be walkable

vast viper
#

Hi i'm currently dissecting PixelCrusher's QuestMachine's procedural quest generation, which is a type of an Action Planner
Just wondering what's the difference between AP and Utility AI?
QM's AP can achieve the sims behaviour, calculating their urgency and figure out a plan to relive that. But what about Utility, which i heard the sims is "officially(?)" based on?

tardy junco
# vast viper Hi i'm currently dissecting PixelCrusher's QuestMachine's procedural quest gener...

If I understand it right, strictly speaking AP and Utility don't contradict each other. Utility ai means that an action is selected based on some formula calculations. Planners mean that the ai can plan a sequence of actions. So, Utility can be a simple state machine, where there's only 1 state changed planned ahead or a more complex planner that calculates a "path" of actions based on their utility. I've used an asset implementing GOAP(called ReGOAP) a few years ago and it was doing exactly that.

vast viper
#

Yep cool. That's what i thought too
I guess Utility is more short term, what is the single action that scores the most and do that
Whereas planners sequentially does this and tracks the world state as it makes the plan, and therefore a heuristics gets relevant to come up with the sequence of actions

reef narwhal
#

I'm attempting to make a playercontroller that uses navmesh. My canMove bool is always returning false and I cannot figure out why. I tried using a normal navmeshagent and it works fine. Tried with both a terrain navmesh and a navmesh component. Any help would be appreciated. ```
private void Update()
{
Vector2 input = move.ReadValue<Vector2>();
if (_Data.state == GameState.explore && input != Vector2.zero)
{
Vector3 newMove = new Vector3(input.x, 0, input.y);
MovePlayer(newMove);
}
}

public void MovePlayer(Vector3 value)
{
    Vector3 newPos = transform.position + value * Time.deltaTime * moveSpeed;
    NavMeshHit hit;
    bool canMove = NavMesh.SamplePosition(newPos, out hit, maxStepSize, NavMesh.AllAreas);
    if (canMove)
    {
        transform.position = hit.position;
    }
}```
#

Alright, turns out you need to make it the thing you are moving the exact height of the plane. so I have to have an empty object as the parent with the move script and move the character visuals to a child.

#

there are probably things you could do to raycast at start to move to correct plane for navmesh but I don't know them.

stable bane
#

Hi, I have a hex-based procedurally generated map and I want to generate a NavMesh. Now seperated hex with walkable biomes (plains, mountains, etc.) and water to separate layers. I read this case requires additional NavMeshComponents from Unity Github https://github.com/Unity-Technologies/NavMeshComponents but maybe there's easier way to do this?

GitHub

High Level API Components for Runtime NavMesh Building - GitHub - Unity-Technologies/NavMeshComponents: High Level API Components for Runtime NavMesh Building

stone owl
stable bane
stone owl
stable bane
#

hm...89โ‚ฌ sounds like overkill for graduation project :/

stone owl
#

I'm not exactly sure how limited it is but it's better than unity's built in by a long shot.

#

*seems to support hexagons in free version

stable bane
stone owl
#

I know you can update the graph in game for the free version, that link is separate-
but if you are wanting an easy fix I would stick with what you know in unity's navmesh, going the component route

#

I don't know how that works but I'm sure it has docs covering that, at least on youtube.

leaden willow
#

I have to repeat the question I need to do this today-tomorrow, and I cant find the answer: "can anyone please tell me how to make a plane block the NavMesh? The case is an island with a sea around it. The submerged parts of the island should not be walkable"

uncut dagger
#

How do you go about creating an AI like in a sports game? (but less sophisticated)
As in:

  • Not Navmesh/pathfinding
  • Has to be smart enough to defend itself
  • But not super smart, player should still be able to score after all

What topics should I be looking at?

jaunty raft
jaunty raft
#

Iโ€™d recommend Focusing your research/design on ways to make the ai as simple as possible while appearing intelligent, particularly for sports you can get away with extremely simple, purely reflex based behavior without any explicit team coordination. Similar to how bee and ant colonies organize themselves, or even simpler.

tardy junco
leaden willow
dusty pilot
#

Just wanted to share something potentially interesting to this group! Adam Myhill from Unity has been working with the folks from Transitional Forms AI, who are using A.I. and Unity to create customized immersive experiences that merge content creation, real-time audience interaction and machine intelligence.

They created something called Dinner Party, described as the following:

Built using a combination of Unity, GPT-3, and Replica, dinnerparty is a multi-model narrative production platform that allows content creators to easily โ€˜seedโ€™ dialogue, audio and visuals that generate the most strangely compelling content in real-time that can be used to showcase whatโ€™s itโ€™s like to co-create with machines.

I'll be joining them as a guest director on their Twitch stream to make some hopefully absurd, strange, live animated content with artificial intelligence! We will even break down how they make all of this Twitch interaction work in Editor!

Come by to say hi at 2pm ET over on https://www.twitch.tv/dinnerpartyai
More info about Dinner Party: https://transforms.ai/dinner-party

https://www.twitch.tv/videos/1170449071?filter=highlights&sort=time

Twitch

Join us every week as we explore the hilariously random and absurdly strange possibilities of generative, live storytelling through the magic of artificial intelligence! Want to direct a show? Like us on social & email us at social@transforms.ai.

โ–ถ Play video
Twitch

dinnerpartyai went live on Twitch. Catch up on their A.I. An Experience With Artificial Intelligence VOD now.

โ–ถ Play video
fleet seal
#

What kind of math do I need for AI in game dev?

#

I want to brush up on my maths.

#

Any recommendation on books/resources would be greatly appreciated.

tardy junco
fleet seal
#

Ah, I see. Thanks for the help.

uncut dagger
#

I was literally researching it yesterday and found this official course/path

#

pretty good imo

#
Unity Learn

In this course, Dr Penny de Byl reveals the most popular AI techniques used for creating believable game characters using her internationally acclaimed teaching style andย knowledge from over 25 years researching and working with games, computer graphics and artificial intelligence. Throughout, you will follow along with hands-on workshops design...

fleet seal
#

@uncut dagger Thanks a lot mate! I'll check it out for sure.

raw tiger
#

someone know why i have this warning

woven cipher
#

i have a question

#

how come my ai prefab is broken

#

its there

#

doing its job

#

just invisib;e

woven cipher
warm goblet
static solstice
#

Hi! I'm making an RTS prototype and would like to see if a building (a GameObject that will be a Nav Mesh Obstacle with a predefined Bounds.size) fit in the navMesh and without colliding with Nav Mesh Obstacles. What's the best way to achieve this? Been trying to find a good answer by reading up on the navMesh docs, but haven't been able to so far.

nocturne bison
#

Can someone recommend any good, comprehensive resources to learn AI that aren't the pinned ones?

jaunty raft
# nocturne bison Can someone recommend any good, comprehensive resources to learn AI that aren't ...

its a field in active development, the common approaches like behaviour trees, GOAP etc are found in the book series "AI Game Programming Wisdom"... later developments you find in GDC talks on youtube. A good general intro to AI (not game specific) is the book "Artificial Intelligence: A Modern Approach" by Russel, Norvig. That book covers all the theory and principles on all the different approaches to AI that have been discussed in academia or used in practice. For the underlying graph algorithms like A*, there is "Introduction to Algorithms" by Cormen, Leirson. More advanced algorithms are best discovered via conference papers/talks. A good intro on ML relevant to games is "Reinforcement Learning: An Introduction" by Sutton, Barto.

nocturne bison
lavish verge
#

So I have a bit of a problem. I want my AIs (or guards) to go through the door, however they're just phasing through them. I want them to go down the red path but they're taking the blue path. I've tried setting various objects as obstacles but that causes them to not be able to go through the door entirely

tardy junco
lavish verge
indigo willow
#

Hi, I am having a weird issue with navmesh agents.
No matter if I use set destination or calculate path manually, the path is always only partial and doesn't lead to the destination.
However, the path should be possible and I can walk there manually when continuously sampling smaller stepps along the way.
Has anyone encountered this issue? Only getting partial paths when it should be possible to get a full path?

unkempt kestrel
#

I'm looking to spell words with gameobjects / transforms / cubes by lerping each object into position to spell, much like a drone show. Are there any resources out there where I can start looking how to do this?

empty osprey
#

Hello I have an issue with the nav meshI come with a doubt about Unity, maybe you guys know something

Do you know how I can have two different agents in the same navmesh in unity? Let's say one that is an enemy and another one is an npc that follows you - now, I have an error where if I use one type of agent everything works but if I use another (with everything the same except the name) I get - "SetDestination" can only be called on an active agent that has been placed on a NavMesh - but it is using the same object only i am changing the navmesh agent in the inspector(which as said, has the same properties as the other one, the only difference would be the name of the agent)

I looked for a solution but it goes like "just change the values of the agent", it seems that for one navmesh you can only have is a single agent: /

#

is the same Game Object

#

nav mesh settings

high carbon
#

I want to work an some ai for my game but Im running into an issue. I want to do a searching related algorithm like minimax or monte carlo, but this requires being able to test out actions before making them. In order to do this I would nee to simulate what would happen with an action without this actually affecting the game state. Are there any ways of doing such a thing? I normally could create new objects with the same data as the old ones and modify those but unity doesnt allow the use of constructers with objects that extend monobheavior, so I cant create new objects. Could I have a unity object hold an instance of an object without it extending monobehavior? like have a script attached to it that is just a normal c# class and have it hold the data of the object while a seperate script that extends monobehavior controls the movement of the script?

jaunty raft
empty osprey
#

great help unity u':

high carbon
arctic geyser
#

hi there... is there any way to bake navmesh on a curved surface like this?

analog pagoda
#

Why use the navmesh for this?

marsh imp
#

I just finished my Ai asset for simulating emotions! PerSim - Personality Simulator. I used research of psychologist James Russel and others for defining the emotions digitally. PerSims can experience a range of emotions to varying degrees at the same time and just might be the most diverse and accurate emotional system for a game. Users can limit the emotions their PerSims can feel or even create their own emotions if there is not enough for your game. It is submitted to the asset store and I'm awaiting approval. If you would like to follow my progress you can follow:
twitter.com/logicandchaos
facebook.com/logicandchaosAssets
If you have any questions or would like to be put on the mailing list to be notified when it is available, email logicandchaosassets@gmail.com

dusty nova
#

Is it possible to manually trigger updates of a NavMeshAgent?

dusty nova
#

I figured something out I guess ๐Ÿค”

rain musk
#

Failed to create agent because it is not close enough to the NavMesh Anyone know how to solve this? When I create a NavMeshSurface

sturdy cradle
#

Possibly have an invisible 3D object that contains the navmesh agent and use it like that

#

That worked for me at one point

#

For the AI

#

Not the surface

foggy heron
#

Is there a way to use Navmesh pathfinding without using the navmeshagents automatic movement?

#

If I simply want to get a vector from the first and second path node to use as movement input vector for say, a rigid body force in said direction or character controller move?

foggy heron
#

Okay turns out I need to use NavMesh.CalculatePath to get the Vector3 corners of the path

#

Only question is this parameter. What does this mean?

foggy heron
#

And another thing, how 'precise' does the vector positions for calculate path have to be? I assume that if you try to calculate a path from a position that is mid air it wont return anything, but how close does this vector position have to be to the navmesh?

molten sequoia
molten sequoia
molten sequoia
#

Just any world position you pass into these methods in general

#

I believe they do more than just SamplePosition to avoid having to use large search radiuses

#

The nearest point is found by projecting the input point onto nearby NavMesh instances along the vertical axis. This vertical axis has been chosen for each instance at the time of creation. If this step does not find a projected point within the specified distance, then sampling is extended to surrounding NavMesh positions.
https://docs.unity3d.com/ScriptReference/AI.NavMesh.SamplePosition.html
Oh seems like SamplePosition already does the vertical finding, so yea, they probably just run everything through SamplePosition

foggy heron
#

Yeah I were just wondering because I assume NavMesh.CalculatePath doesnt return a valid path if it's a position in the air, or something like that, so I thought the 2 vector arguments had to be precise

molten sequoia
#

I meant that I don't think those methods assume the position to be super valid

knotty topaz
#

Hi, we're making a game where the Ais have to follow the player, and we used the navmesh to do it, we've tried to use the navmesh offmeshlinks generated automatically with the navigation component but it seems like the agent can drop from the platform but could not jump to it, cause the offmeshlink has directed the platform below it and not the other way. Is there a way to make it work also the other way ?

plucky zealot
tardy kiln
#

so i want to make my own ai pathfinding script what's the easiest way of doing it?

#

or at least if there is anything that could help me

austere fox
#

The easiest way would be to not make your own pathfinding

#

but a simple google search finds a lot of resources

tardy kiln
#

i tried other scripts but they were a bit too efficient with pathfinding

molten sequoia
tardy kiln
#

basically i want to mantain the movement system i made but still have pathfinding working which is something i havent found a fix to with other pathfinding scripts/algorythms(not sure on exactly the correct name is) such as A*

molten sequoia
#

Sounds like you just need to write your own path navigation

#

Odds are more or less any pathfinding system would work as long as it supports 2D on whatever axis you are using

#

You can generate paths using Unity's pathfinding without using their agent to navigate the path

tardy kiln
brisk raven
#

how do I make navmesh agent stop at a nav-mesh-link so I can trigger certain events like a change animation function ?

crimson quest
#

anyone know how i should start making an ai that learns how to play a game based on three inputs. The positions of its character, detection/position/speed of projectiles and enemies and speed of itself and what weapons it has???

jaunty raft
mental umbra
#

Need help with my Interceptor/Drone code. Works fine while the target is stationary but as soon as the target starts moving the drones just start clumping up at the target's position

high carbon
lime crescent
#

Ok guys i have a big question for y'all. So I was trying to make a Custom NavMesh based on the A* pathfinding algorithm for 3D maps . All I could actually find on Google would be either 2D where the scene wouldn't have any type of 3D maps it would just be a flat surface with walls and stuff or it would be using the navmesh from unity (which is not my purpose). Does anyone have any idea how I could do it? (I've built a system based on various types of getting a navmesh, but for some reason it's not fully working out.) If anyone can shine some lights i don't mind giving out the files or even going on a call and show everything I've done so far.

lone tundra
lime crescent
#

like i don't wanna make an overcomplicated Navmesh like unity has

#

mine should work like a node based one but for some reason my nodes ain't properly right?

lone tundra
#

Not sure I follow.

#

You can a* pathfind through any set of connected nodes

marsh drift
#

how difficult is it to make a waypoint AI that doesnt use pathfinding but still avoids obstacles well enough?

jaunty raft
# marsh drift how difficult is it to make a waypoint AI that doesnt use pathfinding but still ...

difficulty depends entirely on the desired quality of the avoidance (simple case would be something like: if raycasthit, turn 5ยฐ right, repeat). you can also bias those iterative direction changes by a general heading the agent should take to allow them to stay on track or inside a given range... if you add multiple agents you can use flocking behaviour (i..e agents looking at what their nearest neighbours are doing) to enable larger scale avoidance/flow...

marsh drift
jaunty raft
marsh drift
#

Im thinking of doing it all using AddForce and AddTorque but im not sure how to accurately make it turn without overturning and just spazzing out

jaunty raft
#

Maybe add a self correction mechanism that counterbalances the avoidance. Inertial dampening and drag

marsh drift
#

hmmm

#

yeah im not exactly familiar with these things

#

last AI i did was more or less 2D plane and used a big chunk of the pathfinding agents

jaunty raft
#

you can think of it like a little brain of a bugโ€ฆ for every excitement (avoiding) add a desire to inhibit further change (moving straight)โ€ฆ. That balance can be as simple as a float you add/sub โ€ฆ and use as โ€šactionโ€˜ budget

marsh drift
#

๐Ÿค”

#

i dont assume you got anything on youtube for guide?

jaunty raft
#

sorry, thatโ€™s all from general agent theory and robotics

marsh drift
#

the only way i can think of doing what im looking for is to do imitation learning using ML...

jaunty raft
#

There may be some lectures in it on edx

marsh drift
#

and i dont feel like wasting 3 more days trying to make it work and not get anywhere

jaunty raft
marsh drift
#

perhaps, but it adds this sort of randomness to things that make it feel better

jaunty raft
#

thatโ€™s a nuclear war waged on farmers with pitchforks

marsh drift
#

lol

jaunty raft
#

ml just feels soft because it is a stochastic processโ€ฆ you can add those without going full ml

#

if you add some simple or gradient noise to your calculations you get the same fuzziness

marsh drift
#

yeah im just not familiar with AI that much so i cant figure out a way of doing anything near as good

#

right now the only way i can think of doing it is adding way more waypoints than i was initially thinking so they dont get as stuck on terrain and obstacles

#

ah also adding a slight random range outside of the actual waypoint nodes so not all of the AI goes for a single point and just bunch up

jaunty raft
marsh drift
#

huh?

jaunty raft
#

what do you need your ai-actors to do... how should their behaviour look/feel like

marsh drift
#

well for one its a spaceship

#

so floaty controls/movement

jaunty raft
#

if you solve obstacle avoidance via waypoints thats basically a what a navmesh does (in effect)

marsh drift
#

inertia should be a thing

#

aha

jaunty raft
#

but you dont need navmesh and your waypoints should be waypoints

#

since its in space you'd do what a bird would do

#

fly towards waypoint but if there is no direct path, steer to the side until there is a clear path again, then if after some time there is still no clear path, pick a random direction with bias to the next waypoint and fly there

marsh drift
jaunty raft
#

now you make that raycast only look a few seconds ahead and not the whole way and you should get organic looking behaviour

marsh drift
#

thats the thing though; different speed would have different reaction

jaunty raft
marsh drift
#

ill basically have it hardcoded to work only at X speed

#

example of what it needs to traverse

jaunty raft
#

speed can be handled via modifiers to turn rate/acceleration etc

#

at what altitude?

#

in the canyon?

marsh drift
#

yup

#

using ML i added it so it doesnt go above X height, and to try to be above Y height off the ground

jaunty raft
#

you could do what fies do: raycast left right and forward... use the L/R raycast to steer to the middle of the canyon and the forward one to detect obstacles (may need to be more than one raycast for each direction

marsh drift
#

๐Ÿค”

jaunty raft
#

(flies compare the relative velocity of what they see in their left vs right eye to steer such that both eyes see the world moving past at the same speed)

marsh drift
#

weird

jaunty raft
#

imagine the experimental setup in the lab that figured that out

marsh drift
#

haha

jaunty raft
#

fly on a stick

marsh drift
#

yeah i bet

#

somehow this is all passing above my head

jaunty raft
#

if you use ML you'd just feed it a similar type of info and it just figures out how to do it without you having to think about the calculations behind it

#

ML is essentially "lets fix the function with magic"

marsh drift
#

oh using ML i'd probably have to set up the waypoints so that the next one is always in direct sight of the previous

#

yup one reason i went with ML is because of how supposedly easier it is to do stuff ๐Ÿ˜„

#

and its interesting to play around with and see it learn

#

but god damn sometimes it just will not learn anything at all even though it should

#

im also having weird issues where the actual AddForce is frame-dependent even though its called in FixedUpdate....

#

the whole physics might be frame-dependent actually, not sure

jaunty raft
#

make sure your calculation of the pyhsics happen in sync with fixed update

#

its easy to have little value-bugs when polling input/state in Update() and using that in FixedUpdate

marsh drift
#

they are all done in OnActionReceived...

#

which is supposedly called in FixedUpdate

flat granite
#

is this channel also for navmesh problems? somehow unity generates this, with really strange nav mesh polygons

#

any idea how to fix this?

flat granite
#

i'm using the github version for 2020.3 - where's this option?

marsh drift
#

in navigation.

flat granite
#

changing the option doesn't change anything

marsh drift
#

did u rebake the navmesh?

flat granite
#

yeah. i use the navmeshsurfaces, because it's for dynamically created meshes

marsh drift
#

no clue then

#

i'd double check the colliders and layers on that

flat granite
#

well, it's basic mesh colliders

#

thanks for trying though

marsh drift
#

try to avoid mesh colliders unless absolutely necessary

flat granite
#

absolutely necessary in this case

marsh drift
#

well cant recommend anything other than trying if it has the same issue with the unity package one

flat granite
#

can't seem to use that with 2020.3

marsh drift
#

and why is that

#

navmesh has been up for like 5 years now

#

dont think its changed much

flat granite
#

well

#

so, only 2021 has this Add package by name

#

i'm using the github version instead

#

which had the last update a year ago i guess?

#

typical Unity ...

rustic obsidian
#

Just add it via name using the "from git url" option

#

@flat granite

flat granite
#

well, that's still the github version i already use

#

oh wow, it works with the name too. thanks!

#

seems they changed the namespaces?

#

or did they remove NavMeshSurface?

#

this doesn't seem to work at all

#

NavMeshSurface is just missing

flat granite
#

...do i have to install the github version still? or what's happening here

#

what a mess

#

i'm going to assume it just doesn't work with 2020.3. i really can't get it to work

#

thanks Unity, once again you make everything needlessly complicated

raw tiger
#

I use nav mesh agent and my zombie try to reach the player position but instead of try to get around they gang bang with other zombie in front of them, how to improve that ? Like get around for take the other side or just don't move if they cant reach the player position because other zombie are in circle around the player.
https://streamable.com/nhfu4e

private void Chase()
    {
        if (!_navMeshAgent.pathPending)
        {
            if (NavMesh.SamplePosition(_targetDetection.Target.transform.position, out NavMeshHit hit, 20f, _navMeshAgent.areaMask))
            {
                _navMeshAgent.SetDestination(hit.position);
            }
        }
    }
dark willow
#

besides saying "it's a feature and not a bug" possibly try and up the mass of the player, so they push it less? Unless that messes with other physics stuff you're working with, in which case maybe lower the mass of the zombie, that way it'll push less with physics.

#

the zombies will still push eachother, but the player will not be moved around as much

raw tiger
#

I don't have rigidebody on player

#

And the zombie will still not get around for a avoid other and circle the player @dark willow

proud radish
#

Hi All,

I'm trying to use NavMesh.CalculatePath(...) for a second agent type. When I set the agent type Id on the filter I get the following error:

NavMeshBuildSettings for agent type ID: 1 wasn't found

Where do I need to set this up? At the moment I have a NavMeshSurfaceComponent which has NavMeshData assigned to it with the corresponding id. I can't see anyway to specify this Id in the agent settings.

Any help appreciated ๐Ÿ™‚

#

I just noticed - there is another Id on the data that I can't change...

#

Using this autogenerated id seems to fix the problem โœ…

If anyone knows where this comes from, would appreciate knowing ๐Ÿ™‚

celest basin
proud radish
raw tiger
#

I don't think they go around they just overlap agent

#

@proud radish

#

I tried with agent with 10 they just go forward and mush agent with 50 on the side

#

He dont get around

odd tangle
#

Vid2Actor looks cool paper for reconstruction of 3D differential animation
motion re-targetingย 
from a video without noise is a thing

crude silo
#

So I know next to nothing about pathfinding and Im trying to decide whether or not navmesh is the route I should be taking. Ive got units that will need to pathfind their way around a moving ship, is there any consequence to having a navmesh moving around? Or does it work just fine?

tribal agate
near jewel
#

I've set up a few enemies to chase my player through Unity's Navmesh, but it doesn't really work. They move just as intended on flat surfaces but they just stop as soon as they encounter a ramp. It kinda works below 6-7ยฐ, but anything steeper than that is treated like a wall. Only by the agent though, the navmesh itself looks like it should. The whole baking process with max slopes and such works, it's just the agent itself that's causing problems. Not using rigidbodies or anything. Anyone got a solution?

ornate helm
#

Is it a good practice to use State Machine Behaviour or SceneLinkedSMB for AI?

ornate helm
sonic rain
# ornate helm Is it a good practice to use State Machine Behaviour or SceneLinkedSMB for AI?

I personally don't think it is a good practice, as Mecanim was not really built for AI purposes, so here and there you'll find places where it could be limiting your AI
Also, AFAIK Mecanim didn't receive any significant update on the past years? I may be wrong. But it seems dangerous to rely in that, IMO

SMB also doesn't allow you to extend how the state machine works. So if you find a hard limitation, you'll just have to live with it and maybe have to add workarounds for it to do what you need, and Mecanim would definitely hit you with limitations if you need some advanced AI

I understand the value that it holds by offering you a visual editor which shows you the current state and stuff like that though

So I would say that it can be considered for simple prototypes, but I would definitely say that it is not a good practice...good practice would be to study/build your own FSM for actual AI purposes (lots of tutorials on that, even Unity officials https://www.youtube.com/watch?v=cHUXh5biQMg&list=PLX2vGYjWbI0ROSj_B0_eir_VkHrEkd4pi), buuut doing an editor (if you want one) adds a lot of work and tooling knowledge, so it depends on your main objectives

If you still want to research though, I've found some videos on youtube by searching for unity3d state machine behaviour, it just makes me uncomfortable that some videos say it's "Advanced AI with state machine behaviour" while it's definitely not how advanced AI looks like, so I suggest you to take care while evaluating

ornate helm
# sonic rain I personally don't think it is a good practice, as Mecanim was not really built ...

Thanks for the explanation! I've actually found FSM example by Jason Weimann ||https://www.youtube.com/watch?v=V75hgcsCGOM|| which looks as a good starting point for me, and going to stick with that now i think.

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
sonic rain
young peak
#

lol

proven hemlock
#

Hi, im using a Behaviour Tree for my AI, but when the AI dies, the Behaviour Tree still runs some AI code, which gives me errors

faint sage
#

ZOMBIAI

#

How can I create something like, 10 AI GameObjects around the player and them after they're getting far away from him to make the game also run smother?

river fern
#

Si if I place trees and make a mountain with the unity terrain tool, will the ai that is from unity itself avoid those trees an mountains?

Ty

alpine glacier
#

im making game

#

and i want to make enemy follow player i got error\

high zephyr
#

Baking navmesh creates strange spots for places the navmesh can't go where nothing exists

#

little invisible obstacles--everything else in the scene is disabled

#

maybe I'm searching for the wrong things but I've found forum posts and other posts about this but 0 answers as to why

#

like even when it's perfectly level there's just a hole in it for no reason

heavy minnow
#

Is this an imported terrain?

high zephyr
#

yes, do you think it's retaining the old terrain data?

heavy minnow
#

I think that spot is a clump of inverted poly normals. Fix that through blender or any other 3d modelling software

high zephyr
#

hmm if the normals were flipped wouldn't it not render this direction?

heavy minnow
#

Isnt it not?

#

What's the issue? Isn't there a hole?

high zephyr
#

it does render, it's just when I bake a navmesh it creates this hole in the navmesh where no object exists

heavy minnow
#

Oh,

#

Eeh I don't know enough about baking yet, sorry.

#

Perhaps there's some tolerance type sliders you can adjust

high zephyr
#

So far I've cranked the agent settings to be able to go over almost anything and leveled the terrain perfectly flat. Still puts a hole there haha

tulip stump
#

No idea what causes your problem but as a workaround, you could add a plane over that hole, make it static, bake, then turn off the renderer. But clumsy but if you can't find another solution it may be a workaround.

high zephyr
alpine glacier
#

whats the best place

#

to learn Unity

#

especially unity programming

rustic obsidian
sterile wave
#

Hello, I'm trying to let a nav-mesh-agent search the player. But the problem is that it chases the player inmidiately and won't stop chasing when the player is out of sight. Does anyone know why this happens?

using UnityEngine;
using UnityEngine.AI;

public class enemyMovement : MonoBehaviour
{
    //PlayerDetection
    Ray ray;
    RaycastHit hit;
    public LayerMask layer;

    //General
    bool destinationSet = true;
    GameObject player;

    //NavMeshAgent Settings
    NavMeshAgent navMeshAgent;
    int patrolingSpeed;
    int chasingSpeed;

    //Walkpoint
    Vector3 walkPoint;
    public int walkPointRange;
    public LayerMask whatIsGround;

    void Awake()
    {
        player = GameObject.Find("Player");
        navMeshAgent = GetComponent<NavMeshAgent>();
    }
    void Update()
    {
        if(destinationSet == false)
        {
            CheckWalkPoint();
        }
        if (destinationSet)
        {
            CheckPlayer();
        }
        navMeshAgent.SetDestination(walkPoint);
    }
    void CheckWalkPoint()
    {
        Vector3 distToWalkPoint = transform.position - walkPoint;
        if (distToWalkPoint.magnitude < 1f)
        {
            destinationSet = true;
        }
    }
    void CheckPlayer()
    {
        Vector3 playerDirection = player.transform.position - transform.position;
        ray = new Ray(transform.position, playerDirection);

        if (Physics.Raycast(ray, out hit, layer, 15) == player)
        {
            Chasing();
            destinationSet = false;
        }
        else
        {
            if (destinationSet)
            {
                Patroling();
                destinationSet = false;
            }
        }
    }
#
    void Patroling()
    {
        float randomX = Random.Range(-walkPointRange, walkPointRange);
        float randomZ = Random.Range(-walkPointRange, walkPointRange);

        Vector3 tempWalkPoint = new Vector3(transform.position.x + randomX, transform.position.y, transform.position.z + randomZ);
        
        if (Physics.Raycast(tempWalkPoint, -transform.up, 2f, whatIsGround))
        {
            walkPoint = tempWalkPoint;
        }
    }
    void Chasing()
    {
        walkPoint = player.transform.position;
    }
}```
alpine glacier
#

Would anyone know whether there is boolean variant for m_ResetParams = Academy.Instance.EnvironmentParameters; m_ResetParams.GetWithDefault("QuickMovementScalar", 0.0f);
Its a pretty nice method, where the value is set to the default float when there is not value specified in the config file. I am trying to make it work for booleans, so I can specify them in the config .yaml file

river fern
#

how can i make it so the ai only follows the path? now it will walk in to the trees (off the path).

#

already baked

ornate helm
#

How do i setup my behavior tree so it will wait for an unity animator to finish animation in a task? I'm trying to do that for the task that represents attack with a cooldown and can't be interrupted. Sounds like a simple thing but I've kinda stuck on that one...

tribal agate
ornate helm
#

besides dumb check of animationInfo.IsName("name") && animationInfo.normalizedTime >= 1

#

which doesn't actually work that well in behaviour trees

ornate helm
#

what is object field here by the way?

tribal agate
#

if you select an instance of an object with the animation clip in its animator, you get a drowdown of valid functions

#

which is better, but still just as sketchy under the hood

ornate helm
ornate helm
#

It works just fine, but there is also some cons to it, Animator.GetBehaviour<>() doesn't work with interfaces....

sweet steppe
#

OMG there is an AI channel... YAY

#

If anone knows if there is an ai for unity that alows an entiy to interact with the envirnment, consume resources, then make use of those resources, based on certain restrictions, please PM me.

molten galleon
#

Does anyone know how to get a navmesh agent to move by hopping around??? AddForce to make him jump doesn't seem to work because a nav mesh agent appears to stick to the navmesh constantly and refuses to go in the air.

Does anyone know a solution?

tribal agate
molten galleon
molten galleon
#

How to make two different nav mesh agent sizes????? The unity navmesh system doesn't seem to allow that AT ALL. So I can't have one NPC be bigger than another because he will clip inside walls because he's treated as the same size as the small NPC

molten galleon
#

Apparently I need to download a custom package for it from github?? Why is this not included in unity by default? I can't find it in the package manager even though the github page says it's there (yes "show experimental packages" is turned on, and I'm on LTS long term support version). Apparently it's only for the 2021 non-LTS "beta" versions? So I have to get it from github?? And how do I use that package to make different navmesh agent sizes? The documentation is messy

#

Can anyone help?

halcyon stratus
#

Yes

molten galleon
#

Where is the documentation for the navmesh extras package made by unity?

#

How do I use it to make a navmesh for multiple agent sizes???

stone owl
stone owl
#

And Relax. nobody wants to help you when you seem this impatient ?????

cerulean sorrel
#

This is doing my head in. Anyone experience navmesh carving around objects that have no obstacle component on them?

#

Incredibly difficult problem to google. Conflicting keywords I guess.

#

Okay, for the record I fixed it. Though I'm still a little surprised and shocked that you can carve a navmesh without an obstacle component. I changed the navmesh surface to use the geometry of "Physics Colliders" instead of meshes. ๐Ÿ˜•

tribal agate
cerulean sorrel
#

Weird, right?

tribal agate
#

ah, okay

#

nah, you're baking. That's the behavior I expect

cerulean sorrel
#

Oh?

tribal agate
#

if they're navigation static then it carves them out

#

it thinks they're walls or something

cerulean sorrel
#

Even though they have no colliders?

tribal agate
#

nav mesh doesn't depend on the physics system

#

you could use it without any physics at all

cerulean sorrel
#

Okay

#

Good to know. Thank you.

#

So what's the purpose of the obstacle component. Just additional tweaks I guess.

tribal agate
#

you can modify the navmesh without rebaking it

#

put it on a door

#

or a crate

#

or w/e

#

stuff that will move at runtime

#

not static

cerulean sorrel
#

Awesome. Thank you.

cerulean sorrel
#

Does anyone know how to avoid navmesh clumping. My enemy AIs get very confused for about 0.2 seconds when a player enters the red circle area.

#

They like, freak out, lose the target, recalculate, and the proceed to behave normally.

static solstice
#

My NavMeshAgent keeps missing the target I want it to attack, e.g running in circles around it, or missing it completely if the target sidesteps, instead of hitting it. These are the settings. Any tips?

cerulean sorrel
stone owl
#

Im on mobile but it looks like you need more "tiling" for the navmesh. Like you see how you have so many points anchored to these large grid corners?

#

If you mess with the bake settings so you get a smaller grid (larger voxels?) I bet you that does something

#

Hope that makes sense.. 4am just an idea lol

cerulean sorrel
pliant edge
#

There was a website from adobe where you could download agents and animations... But i can't find it again. Does anyone know which is it?

#

I think it was from adobe

#

Mixamo it is ๐Ÿ™‚

cerulean sorrel
stone owl
#

Awesome! Glad to hear it ๐Ÿ˜„

alpine glacier
#

Finite state machines are 1000x easier to implement than behavior trees.

Itโ€™s taken me 2+ months to write my own implementation of BTs (ITโ€™LL BE EASY they said). I wrote and wrote automated tests for a finite state machine in 2 hours last night.

I cannot wait for global game jam because Iโ€™ll get to talk IRL with some experienced programmers and I can talk about it.

#

I am a guru at this point

#

For BTs itโ€™s a lack of clear resources that hindered me. Most YT videos keep it high level (and honestly, you can tell they donโ€™t really grok it). There arenโ€™t too many blogs that I was about to find that described an implementation.

To add injury onto insult, there is a buggy Packt book from like 2017 with a buggy BT implementation that seemingly everyone copies.

#

But I figured it out. I referenced the text written by ancient prophets (from gameaipro) and I knocked out a BT implementation. Again, lack of detail made it take a lot of time, but now my eyes GLOW with BT knowledge

alpine glacier
#

Omg, I was just flipping back through gameaipro the book and realize I missed something kinda bigโ€ฆ There is a URL to sourcecode that I missed. Omgโ€ฆ Reading through the code here would have really sped me up. Literally I just saw it.

https://github.com/aigamedev/btsk

GitHub

Behavior Tree Starter Kit. Contribute to aigamedev/btsk development by creating an account on GitHub.

#

They even have tests in the code. Wow, what a public display of human folly. How much time did I spend that could have been avoided if I had only found this before. Wow

stone owl
#

Fsm good for smaller needs.. The more complex the more you wish you have a tree haha. I hate dependant states.. Unnecessary.
Halo is a great example of some nice bt.

silent saffron
#

Hello! Does anybody knows how to fix A* NullReferenceException: Object reference not set to an instance of an object error? First time using it, confused why error happened

alpine glacier
alpine glacier
ripe mirage
#

Or i just don't see it?

silent saffron
#

Here is the error message

#

Something weird happens to pathfinding

ripe mirage
#

Wait a second, ill just move to the pc, its to hard describe on mobile

ripe mirage
#

I'm back

#

so

#

It says this: This error is common to beginners for .NET/C#. This exception is thrown when you try to access a memberโ€”for instance, a method or a propertyโ€”on a variable that currently holds a null reference. Site: https://stackify.com/nullreferenceexception-object-reference-not-set/

ripe mirage
#

ehhhh @silent saffron ?

silent saffron
#

Yea?

#

Thanks!

ripe mirage
#

no problem.

ripe mirage
#

i know it may be better to ask us, but i searched too, so i'm not a pro inside errors and such too

velvet radish
#

How can I make the nodes center? As you can see, it's like on the corners of it.

stone owl
velvet radish
#

The red is the blocks that is used to generate the available path.
The dark red is the nodes, I believe they're called.
And the blue is the space they can walk in.

stone owl
#

actually, it says "old" in the title might be off

#

ohhh yes I recognize this now.

velvet radish
#

i can show screenshot of settings; one second

stone owl
#

so you're trying to line up the center of your nodes with your tile space?

#

might be a little unnecessary if I remember correctly how this generates walkable area

velvet radish
#

unnecessary?

#

if it works on corners, then the opposite corner will be walkable through

stone owl
#

I can't advice you since I've just used this for general purposes maybe it was even a completely different setup that just looks similar

velvet radish
#

so two things.

stone owl
#

I see in the docs nodes have a position property you can access perhaps setting it manually to each tile (iterating through the map or something)

velvet radish
#

well

#

so i have a building system

#

when u place block, it'll find the node closest to that block, and it'll market it as non-walkthroughable.. as shown in picture:

#

the nodes are split at half of the block, that's the issue, so it's selection is pretty random

stone owl
#

right- so you just want those nodes to generate at the center of your tiles

#

instead of in their own grid which doesn't seem to match your tiles

velvet radish
#

yes

#

but originally

#

i had the node size as 0.5 (instead of 2, as shown in picture)

#

and this causes each tile to generate 4 nodes, as shown here:

#

however, like i said, when i place a block, it finds the closest node to it:

stone owl
#

is this map procedural or by hand?

stone owl
#

is that possible for your setup?

velvet radish
stone owl
#

Just a thought, wherever you generate -Tile- at -Position- include in that generation process the Node generation, which I'm sure is exposed by A*

velvet radish
#

I'd think by default, the node would follow the same format

velvet radish
stone owl
#

right.. ok hold on, are there any offset parameters you see? Could

#

be as simple as offsetting the grid.. because you had the right size, it just wasn't lined up with your grid

velvet radish
#

The "center" just tells that specific graph where its center is.
I suppose this one gameobject can generate multiple graphs (as seen by the "Add New Graph" button in picture)

stone owl
#

timestamped at 1:38

#

showing the offset lining up to the tileset

#

oh it's the same center as you have there.. hmm

velvet radish
#

hm

#

something

#

fixed lol

stone owl
#

oh no way?

velvet radish
#

well

#

no

#

i thought it did, but looking at all of them, it looks like it got offset even more

velvet radish
stone owl
#

changing the scale of the grid results in too many nodes at a position; would it be crazy to scale your tiles ?

velvet radish
#

i wouldnt wanna mess with my tile generation

stone owl
#

I believe in the video Aron has a standard scaled sprite tile 1,1,1

velvet radish
#

cuz that's a good 100 lines.
compared to this A* is brand new and probably only needs a few touches

#

i saw the video

stone owl
#

ah yeah that would be a pain indeed

velvet radish
#

butt hat scales the block position

#

not the nodes

stone owl
#

he's got a 2d box collider on each tile as well

#

not sure if that plays into anything

velvet radish
#

i do as well

stone owl
#

well without seeing your generation/sizing code feel kinda helpless over here maybe someone in #archived-code-general could help you size your generation to standard sprite size- but that's just last resort.

velvet radish
#

hm

#

this

velvet radish
#

had to set the node size to one
and change the center, as the guy did in the video

#

and when i place a block

#

looks perfect! i guess i just expected the red square to be the same size as the area it can't walk through.
but it's not haha
so thanks @stone owl ! all is working now

stone owl
#

that's great glad to hear it ๐Ÿ˜„

silent saffron
#

I know am posting with the same issue kinda? But today when I reloaded unity, the error message disappeared, but pathfinding still teleports enemy in a specific spot? it seems like [Computation Time 0.00 ms Searched Nodes 7 Path Length 7] suddenly switches to [Searched Nodes 137 Path Length 28? ] What could possibly cause this? I am very new to C# and I tried looking it up online, but still cant find what causes this sudden jump. Does anybody knows what this specific issue is called???

upper flare
#

Hi, i had this line of code set up agent.SetDestination(player.transform.position); so that my enemy would move to the player to attack him. After I edited my terrain a bit though he suddenly stopped walking around. I re baked the navigation mesh, I increased the max slope, I made a different gravity script but to no avail. What could be causing this issue?

stone owl
upper flare
upper flare
real sonnet
#

@upper flare I didnt look the code but you said you made a different gravity script : does it set the position by any chance ? Beginners often make a mistake here

#

There could be a conflict if you overwrite the position from another script

upper flare
real sonnet
#

Ok it's player controlled and you're looking for smthg wrong with an agent so nevermind

gritty sable
#

im trying to make an animation play with the nav mesh agent and the animation works but not the nav mesh, if i remove the animator then it works, any help?

alpine bane
#

Yes don't put the animator behaviour onto the same game object you put the animator on. Since it keeps the position of game object in control, while the nav mesh agent moves.

#

@gritty sable

#

Reply if it helps!

upper flare
#

Hi, i had this line of code set up agent.SetDestination(player.transform.position); so that my enemy would move to the player to attack him. After I edited my terrain a bit and he suddenly stopped walking around. I re baked the navigation mesh, I increased the max slope, I made a different gravity script but to no avail. What could be causing this issue?
https://pastebin.pl/view/01e99c3f

barren grove
#

Is there a way - preferably built into unity - that I can have a non-static gameobject [eg a piece of a destroyed wall] counted as a 'step' for the purposes of AI pathfinding?
Currently my agents just try and push through the rubble, but I'd like them to - not quite climb, but float up and over smaller pieces of debris

stone owl
#

At runtime to account for the new pieces.

barren grove
#

ah damn. i was hoping there was some kind of inverse NavMesh Obstacle

round citrus
#

it is suposed to follow me...

#

but it don't follow and just gave me errors

zealous mantle
#

Do you have a navmesh?

round citrus
#

ye

zealous mantle
#

That's a navmesh agent. Do you have a navmesh as the error specifically mentions.

round citrus
#

like a navmesh surface?

zealous mantle
#

Yes, like a navmesh

round citrus
#

interesting results...

gloomy holly
#

When researching the function samplePosition regarding what the max or recommended radius should be, and all I find is whatever the agent height is times 2. My program has really no need for agent height.
What is the recommended limit for this value?
Currently mine is set to 13 when I use it, but I just tried 1000 and saw no differnce in performance.

Also, does warping an agent use this function behind the scenes as well? It seems that when warping an agent outside the navmesh, it will still find the closest available position on the navmesh to a certain extent

round citrus
#

any idea for what happened?
(the thing should continue attacking me and following/facing me but instead, it attacks me once and stops)

#

i will dm the scripts for anyone that is up to help me

#

oh btw and when it attacks me it gives me alot of errors, like ALOT

gloomy holly
#

somewhere in the script you are accessing the animator of I assume the bug, but somthing about it doesnt exist

#

or there is a getHit kind of animation that the palyer doesnt have

round citrus
#

well i can show you my AttackBehaviour Script

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

public class AttackBehaviour : StateMachineBehaviour
{
    Transform player;
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        
    }

    // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        animator.transform.LookAt(player);
        float distance = Vector3.Distance(animator.transform.position, player.position);
        if (distance > 20)
            animator.SetBool("isAttacking", false);
    }

    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        
    }

}
#

huh one question do i need to use

using UnityEngine.AI;
```?
round citrus
gritty sable
round citrus
real sonnet
#

That's a veeeeeeeery broad question. One that can't really be answered in a chat. Also depends on each game, so can't answer with no details like that.

#

I could say start small, and keep adding/refining until you get an interesting behaviour. But that doesn't really help, right ?

#

With experience on your games and inspiration from other games/devs, you'll learn how to build more and more interesting AIs

open yarrow
#

I have a big platform that leads into a narrow platform, and when my navmesh agent tries to go from the big into the narrow he slows down, it doesn't happen when i turn off obstacle avoidance on it, but I don't think I should do that. I've tried making the narrow platform a bit wider which does help but does not fix it. Is there just a minimum width needed for the agent to go on it properly? I'm a big beginner, so I wonder then how do I make narrow platforms the AI can also reach?

somber kestrel
velvet radish
long swan
#

Hello, so ive been looking into enemy ai, and ive decided to use nav mesh agents, the thing i notice with it is that if i set it a high speed for example 100, it takes quite a while to turn back to my character, any settings in the nav mesh agent that could fix this?

river fern
#

ai does weird, downloaded the code and used the checkpoints right

#

In this video series Iโ€™ll show you how to create a simple car AI (Artificial Intelligence) in C# Unity which is built for 2D Games but also works in 3D. Download complete project on Patreon: https://www.patreon.com/posts/51162606

With this tutorial youโ€™ll be able to make a physics based race game with AI and lots of drifting in no time in Unity...

โ–ถ Play video
#

from this video

real sonnet
woeful wind
#

Hey I am using Nav Mesh Agent, and when the base offset is set as default (0), it will work, but it clips through the ground, it works all the way from 0 - 3 then at 4+ it just stands still. Could anyone help with this? Thank you

#

top image is default base offset, bottom is 0.452

rain roost
glossy hazel
#

I want to use Movenet in unity
I was thinking to use barracuda
I converted tf movenet to onnx and tried to use it gave error

Unsupported default attribute `split` for node sequential/keras_layer/StatefulPartitionedCall/StatefulPartitionedCall/unstack:0 of type Split. Value is required.```
jade nacelle
#

Hi, I've got a little question relating to navmeshes. I have a navmesh imported from another project as a graph, I wonder how can I bake it as a Unity navmesh (if possible)

#

It appears that we can't generate navmeshes programmaticaly

stone owl
#
Unity Learn

In this recorded live training session we show how to work with Unityโ€™s Navigation tools at runtime. We will explore the publicly available Components for Runtime NavMesh Building and look at how we can use the provided components to create characters which can navigate dynamic environments and walk on arbitrarily rotated surfaces, including ene...

jade nacelle
inner pilot
#

Hello, I've got a small problem with A* pathfinding. I'm making a turn based 2D game with tiles and I've included the A* pathfinding and it works fine by adding a blocking layer in the tilemap but how can I tell it to not be able to pass through players/enemies etc that are gameobjects? My problem is that now 2 enemies can stand on the same tile which I don't want to happen.

zenith frigate
#

Can anyone point me to documentation/an example of how I might use Navmesh and a NavMesh agent for pathfinding, but not for the actual movement? I'd like to define my own way and rules of moving the agent, but still use the built in NavMesh and pathfinding tools.

stone owl
woeful wind
#

Hey I am using Nav Mesh Agent, and when the base offset is set as default (0), it will work, but it clips through the ground, it works all the way from 0 - 3 then at 4+ it just stands still. Could anyone help with this? Thank you

#

top image is default base offset, bottom is 0.452

stone owl
#

(both images are the same)

#

the base offset is set to the model's pivot point.

woeful wind
#

Oops I didn't realise that, the other image was the monster not clipped in the ground, but not moving

woeful wind
#

Well I changed the height and it kind of works? He starts going side to side and not even following me

stone owl
woeful wind
#

How would I check that?

woeful wind
stone owl
woeful wind
#

One of my friends does

stone owl
#

Maybe ask him if he can re-center the pivot point of that mesh.

#

otherwise it's probably the way you have your object setup, which is the parent which is the child so on

woeful wind
#

Okay cool, thank you

#

I somehow fixed it, but now it's going super slow, I change the speed of the navmeshagent and it still doesn't speed up at all, I need to go to bed so I will check to see if anyone replies in the morning.

stray pond
#

how do i import navmesh?

stone owl
#

unity does not translate third party navigation meshes that would be up to you

stone owl
#

filter off areas you don't want, so on

swift roost
#

What would be an ideal AI solution of creating a life like simulator 2d. By that I mean you place resources and the people placed choose weather they collect wood, build, research and more by themselves. Almost like worldbox

#

I was thinking of a state machine but I'm not too sure if there is a better solution

sonic rain
# swift roost What would be an ideal AI solution of creating a life like simulator 2d. By that...

Perhaps you might have some Utility Theory, to reason about the bots necessities in a more mathematical way
In this message, I explain it a little bit:
#๐Ÿค–โ”ƒai-navigation message

I also suggest taking a look at the video from AI and Games. In the moment that I marked, he explains a little bit about how it is used on The Sims, which might be similar to your case:
https://youtu.be/p3Jbp2cZg3Q?t=400

Support AI and Games on Patreon to get your name in the credits, early-access and more:
http://www.patreon.com/ai_and_games

Sometimes the AI in a videogame has lots of perfectly valid actions it can take, but deciding which one can be quite difficult. Utility AI is one approach to help solve it, by calculating how useful that action is base...

โ–ถ Play video
alpine glacier
#

So I have some tables and chairs in my restaurant

#

Is there a way I can make it so when my AI gets scared they run through them

#

This doesn't have the intended effect

#

(Please ping if you reply)

iron vault
#

umm when i click bake in navigation tab, nothing happens just nothing(ping me too if you reply)

sick latch
#

I'm trying to figure out how to make a companion NPC for a project, I want it to avoid obstacles and affect/be affected by physics objects and forces, how should I approach this?

#

I searched for some tutorials but all I could find relied on navmesh to do it and I've seen some people comment out that it isn't a good idea to use it for that purpose

thorn hemlock
#

I'm making my own behaviour tree tool and I'm seeing a lot of people with a similar task implement the concept of "blackboard", which acts as the memory of the tree which all nodes can access. I'm really confused as to why this is needed though, why cant the relevant variables be stored on the AI agent's behaviour class? Why separate it into a different class? Seems a bit convoluted to separate it.

sonic rain
# thorn hemlock I'm making my own behaviour tree tool and I'm seeing a lot of people with a simi...

You separate it exactly to decouple the concepts, which is simply a good practice in coding. The Behaviour Tree classes can, for example, deal only with branching/acting logic and be agnostic to the maintenance of a memory (blackboard). If you mix their structures and algorithms too much, you'll create dependencies and they will start to bump into each other and chances are that you'll be facing situations where you don't know if the problem is either on the BT or the BB

So the clear separation is mostly because of that but, of course, it always depends on your coding preferences, if you feel like not separating it, then that's fine

I must highlight that the blackboard is not only seen/spoken of in Behaviour Trees. The blackboard is simply the concept of a memory which you can access with a key, and you might have global blackboards (i.e a place where all agents can get shared data from, such as "where is the next team objective position"), you might have per-entity blackboards (i.e it stores data related only to a specific agent, like "what is my current objective")
This is useful not only for behaviour trees. It can be used a lot in HFSMs, GOAPs, Utility Theory, etc...

Now, imagine that your game AI code evolves within time, and then you have some place where you want to consult a position where the agent wants to go, and the class that needs this info is, for example, some nav mesh system. If your agent memory is built inside the behaviour tree, you will start to entangle your nav mesh code with the behaviour tree code. Then this can become a snowball, where you just need to get memory, and suddenly many parts of your project now has a dependency on the behaviour tree, but wait...wasn't the behaviour tree's purpose to deal with branching and acting? Now it is also a memory?

#

It would be like implementing a subclass Calculator.MathOperations, and put UI things there, like Calculator.MathOperations.ShowUIDialog(). Why does a maths class has UI in it? Shouldn't it be just...maths?

#

If you implement the blackboard separated, you can even re-use it in other projects/situations. If you implement it within the BT, you'll always have to take everything with it, even if the project doesn't need BTs, but rather implements HFSMs, etc

iron vault
alpine glacier
#

Look at the top right of your Geometry

#

did you tick the static box

iron vault
#

ohhh

#

thanks lol

thorn hemlock
livid viper
#

how can I make self learning agent AI in Unity?

hot anvil
#

How to make multiple AI follow different points in finite state machine?

marsh imp
# sick latch I'm trying to figure out how to make a companion NPC for a project, I want it to...

I always roll my own Ai systems in games, I would make a character that uses vectors for movement, then you code it to keep within a certain range of your player and use rays for obstacle detection or you could add triggers to obstacles, which is something I have done in games, or even a dynamic vector flow field around the character and steer away from the obstacle using vector math. Using rigidbody and velocity for the movement will allow it to be affected by physics.

marsh imp
# swift roost What would be an ideal AI solution of creating a life like simulator 2d. By that...

For a Finite State Machine or even a behavior tree, states/behaviors usually have to be hard coded in and are predefined and finite. I use a fuzzy pattern matching solution I developed, that runs in a Fuzzy State Machine (FuSM), it's similar to utility function, but rather than examine all the factors and then make a decision it chooses the 1st match, also all the conditions are binary.. Another thing to look into is Goal-Oriented Action Planning (GOAP) https://gamedevelopment.tutsplus.com/tutorials/goal-oriented-action-planning-for-a-smarter-ai--cms-20793

Game Development Envato Tuts+

Goal Oriented Action Planning (GOAP) is an AI system that will easily give your agents choices and the tools to make smart decisions without having to maintain a large and complex finite state...

sick latch
stone owl
stone owl
marsh imp
# sick latch how would you make the character follow the player if there's a wall between the...

I would get the companion to look at the player then have it move towards the player until it reaches a certain distance, making your npc characters move facing forwards makes it easy to use steering behaviors, so you make it look at the player, but then you can rotate it if you detect an obstacle. Using vectors is a great way to control movement.

Really there are so many ways you can do it, you could even make the npc follow waypoints periodically placed by the player and have it keep a certain distance away, then it will follow same path as the player.

Just depends on how you want your Ai to behave.

alpine glacier
alpine glacier
#

hey umm anyone know a package that can generate pathfinding algorithm for a hexagon board?

#

like the A* project has one

#

but the shape is not how i want it

static kelp
#

hey im trying to tell if an enemy ai's navagent has a path that it cant reach.

if (navAgent.pathStatus == NavMeshPathStatus.PathPartial)
        {            
            Debug.LogWarning("invalidDestination true");
        }
        else
        {            
            Debug.LogWarning("invalidDestination false");
        }
``` neither of these are returning true or false even though the enemy is trying to reach my player standing on a ledge that it cant reach. the NavMesh.SamplePosition() returns true because it is a valid nav mesh position however it clearly cannot create a path to it.
#

ive also tried == NavMeshPathStatus.PathInvalid too which also has no results

alpine glacier
#

I'm able to get it to work with flat ground

#

but is there not a way I can do it with windows / walls?

#

It would be 100x more helpful if instead of Carving out the Navmesh, it would allow you to change the mask of the ground below it.

#

I can probably change the ground below the windows to the layer and make the windows not static, but that's extremely finicky so it's a last resort

#

nono wait, i built all the buildings in a way where that shouldn't be very hard

#

but the table and chairs elude me

#

hahaaa it works

tribal dew
#

Hello guys, is there someone who work on rts game have question about navmesh Agents local avoidance.

eternal stag
#

don't ask to ask just ask

shy valley
#

Where did NavMeshSurface go?

#

I can add a NavMeshSurface component in the editor, but I can't access the NavMeshSurface class in script?

What gives?

#

Fixed now, just Unity editor being weird I guess.

cloud depot
lyric moth
#

has anyone here worked with the A* pathing project?

#

I have a question about the generated grid heightmap. Is there a way to make an agent stick to the heightmap generated by the grid?

snow agate
#

i was suggested to ask here, so...
when someone gets a chance, my charicter rotates on the y axis when i move, and i am using navmesh to move, the code seems fine i was told, i think that its my navmesh or the navmesh agent that causes it when i use the set destination

buoyant mesa
alpine glacier
#

Im considering writing it myself

#

i need a 8x8 hex grid (square layout).

#

cause its like a board

#

the weird approach was to use the point grid

#

and give it all my points and restrict the point length to 1

buoyant mesa
alpine glacier
#

i have

#

i want the hexagon map to generate like this

#

i've looked at red blob game's gude on hexagons.

buoyant mesa
#

Oh okay, I am sorry I am no use in that area.

alpine glacier
#

np

gloomy sail
alpine glacier
#

I'm in 2d. I can't find the nav mesh surface

alpine glacier
#

you will want to use other libs or create your own

#

so far the a* pathfinding project seems to be the best bet

nocturne bison
#

Any good free behaviour tree solutions you guys can recommend?

sacred heart
#

Just out of curiosity, is anyone here working with ml-agents?

#

or is that for the ml channel?

nocturne bison
#

It looks like its working. For now, i've barely tested it

alpine glacier
#

my ai is pathfinding path that are clearly within the radius ive defined. can u help me figure out what is going wrong here?

stone owl
alpine glacier
#

i was thinking there was some built in automatic avoidance system that accounted for the size of the AI. but it is just for graphical representation. unless im wrong

#

so then the fix was to create a custom graph for AI based on size.

#

thanks for answering tho. appreciated... again i might be wrong on my assumption, so if anyone knows, pls respond

eternal stag
#

@alpine glacier what are you using for pathfinding?

alpine glacier
iron vault
#

How can I stop clipping like this? (the red cube)

jaunty raft
jaunty raft
#

if those objects are driven by ai/kinematic controllers, you have to avoid collisions manually via pathing on a navmesh, a custom kinematic controller or something else

iron vault
#

but it still collides with it

#

i do use navmesh pathing

jaunty raft
iron vault
jaunty raft
iron vault
#

yes that does makes sense ill try to do that thanks

alpine glacier
#

anyone here know how to assign penalties to something like mud on the map?

#

A* pathfinding project

alpine glacier
#

I want it to be able to move thru a node. but i want to assign a penelty, saying if you move thru this one, you move 100x slower, so unless there is a faster path choose that. How can i do this?

eternal stag
#

It's usually called cost

#

Terrain cost or node cost

alpine glacier
full bramble
#

Hello everyone! I'm here to ask what way is better: Machine learning or AI? I'm asking because I'm working on a project where, in assumption, an AI/ML would predict the behaviour of some chemical compounds as well how the chemical equations to use.

thorn hemlock
#

At least for offline learning

#

For online learning im not sure

#

I'm trying to figure out a good way to make my navigation agents surround its target properly, instead of clustering on one side. I know of the technique of having points around the target that my agents can path to and occupy, but it's not a great solution to my problem. Are there any alternatives? Doesnt have to relate to Unity's navigation system, i cant get it working in my own system either.

nocturne bison
# thorn hemlock I'm trying to figure out a good way to make my navigation agents surround its ta...

dont know what exactly you mean but perhaps this vid helps https://youtu.be/6BrZryMz-ac

Combat keeps the player engaged as they explore my game, so I improved how the enemy interacts with the player and their environment. This tweak made combat so fun that a tester spent over an hour repeatedly fighting a handful of enemies. At this point I knew I had an engaging combat system!

Howdy, and welcome to the 12th indie game devlog for ...

โ–ถ Play video
#

he does deal with enemies surrounding the player

full bramble
thorn hemlock
thorn hemlock
# full bramble wdym offline learning?z

Not sure if that is the official term, but its when the neural network model has completed its training and is deployed to the game, and the model doesnt learn while a real player is playing. this is opposite to online learning when the ML model learns as the player is playing, to learn the patterns of that specific player. (again, might not be official terminology)

alpine glacier
#

how do you make an ai jumpscare you

#

if you go into it

full bramble
thorn hemlock
full bramble
#

I mean like

#

in this usage

#

of chemical reactions

#

which is better

thorn hemlock
#

I don thtink i understand the problem completely. You are making a system that puts two elements together to create a chemical reaction. Wouldnt the chemical reaction be the same every time? Does the AI need to predict that?

#

Either way I think offline is the way to go, since it doesnt seem like a player behaviour would impact your system.

full bramble
#

properties

#

of the product

thorn hemlock
#

Yeah, I'm pretty sure its a problem that a free forward neural network could solve.

#

as long as you have a set of training examples for it to learn on

full bramble
#

Since I'm not the most experience in the field of neural networks, free forward neural network is...?

thorn hemlock
#

A free forward network is the most common artifical neural network and probably the one you'll learn about when learning about neural networks. It's a multi-layered network where data gets forwarded and adjusted from input to output. I'm still learning about it for my thesis, so i shouldnt be lecturing on it. But there's a lot of great guides online about it. This is a great guide on how neural networks work: https://www.youtube.com/playlist?list=PLZHQObOWTQDNU6R1_67000Dx_ZCJB-3pi

full bramble
#

and it works in unity?

thorn hemlock
#

ML agents in unity use deep reinforcment learning, which is sort of a mixture of this techinique and reinforcement learning. Im not too educated on it. But what I think you could do is train your model with Pytorch (which unity ML agents is based on) and then export it as .onnx file, and then put it into unity ML agents, and use it as your "inference" behaviour: https://medium.com/@a.abelhopereira/how-to-use-pytorch-models-in-unity-aa1e964d3374

#

Disclaimer: I have not done this, this is just research ive done for my thesis which is about this subject

#

Seems to be the way to go though, since supervised learning seems to be used more for prediction than reinforcement learning

full bramble
#

Don't ML Agents only operate on numbers though?

thorn hemlock
#

Yeah, pretty sure all ML models do that. You could map numbers to specific properties/chemical elements

full bramble
#

aight, thanks

full bramble
#

Uh, hey @thorn hemlock , I am having a bit of an issue with what you've sent me

proper raven
#

hello,
if my navmesh agent is too far away from a baked navmesh, it sets a path towards the closest baked navmesh edge,
how can I turn off this behavior?
(Auto Repath is already off)
[edit: solved]

full bramble
#

@thorn hemlock ^

thorn hemlock
full bramble
#

I see.

iron vault
#

is there a way for a navmesh agent to have a different agent radius than another? The problem is an ai is too big for the bake and slightly clips through walls while the smaller ai doesnt

molten sequoia
#

@iron vault You can at least with NavMeshComponents, check the pinned post.

gritty valve
alpine glacier
#

I am using the pathfinding project. i have figured out everything except how to scan a path around moving colliders (other ai and player)

#

How do i generate a path that avoids going thru other ai, players'... current locations

#

generate "around" / "avoid"

proper raven
alpine glacier
#

this is what i mean. as you can see the green line from the seeker goes thru my playertank

#

i want it to nav around the player

alpine glacier
#

the commented out line lets up update the nodes that the player sets. however this is inefficient. instead of going thru scanning and resetting the tags on the nodes for the whole grid, i just want to delete the ones from the player, and set the new ones on the area the player is at

atomic bronze
#

If i set my navagent destination only to player pos the agents clumps togheter, how can i add the position around player in a circle?

alpine glacier
#

now if you want all ai to surround the player without clumping together?'

#

I suppose ai will can be set as obstacles, so they navigate around each other. so when one ai comes behind the other, it tries to go around. that might lead to a circular surrounding pattern. this ofc isnt tested, and there are probably other and better ways to do this. this is just easy to make tho

#

once the player is fully surrounded, further ai wont be able to find a path to the player and hence their enclosure would be thin. ... idk how to make them keep clumping like COD zombies when the player entered a glitch zone

#

in this case, the ai doesnt treat others as obstacles, and just pushes them aside. only stopping X distance from player. but this would mean that AI behind will push the stopped ai forward. in this event, the x distance away can become "static" or have a script that makes then flee from until x distance away from player, so they push back. but then they too will get pushed back from the further buildup of waves

#

in this case, the push backers can be made actually static, while they are pushing back they cant be push inwards. like a force field

#

the best option would be to dynamically increase the stopped ais mass by the number of ai units and increase their force as well. because static rbs, going back to dynamic will lead them to firing out. which could actually be a feature, not bug.

zealous mantle
#

You want to look up how to implement flocking behaviour using boids.

atomic bronze
#

Thanks guys gonna take a look

#

I dont think obstacles gonna work if i got many many Npcs

flat granite
#

hi, is it possible to set a NavMeshSurface to Use "Physics Colliders" but without any physics colliders that are set to triggers?

alpine glacier
#

can someone link a simple ai tutorial that updates constantly and avoids box colliders

eternal stag
tight raven
#

My NavMeshAgent is spiraling to it's destination for some unknown reason. It might be because of the high maximum speed I gave it, though it's strange when the idea is to get as quickly as possible from point A to B. Is there a way to keep the speed while not making the agent spiral?

#

Here's a preview

molten sequoia
tight raven
#

I set it to 3000

stone owl
#

Whats agent speed set to?

#

I usually try max angular out at 9999 or something lol

#

There is always the option of forcing agent to not update rotation and doing that manually yourself.

tight raven
#

Its only 20

#

Am I supposed to rebake after changing the angular speed?

hollow path
alpine glacier
# eternal stag google.com

there is nothing on google ive read the entire A* documentation or the one they provided looked thru 10+ videos and none tell how to make a enviromental changing ai bot thing

alpine glacier
#

2d

eternal stag
#

hmm?

alpine glacier
#

for 2d gm

#

game

#

ill just start experimenting

livid viper
#

guys i have a problem with my game: I added model to the game from blender and i added ai (navmesh) and script that controls ai to game. I had to rotate it because (y and x rot) and my ai stoped walking.

#

here's my script:

shell forge
#

May I ask a question about pathfinding on NavMesh?

#

I have an actor set to walk towards a destination point on the NavMesh, but every time I try to set its position with a raycast, the Destination Point has to be close to the Player, or it won't instantiate at all

#

This is the code I'm using, NavMesh is baked and the variables are set on the inspector

#

It does move towards the point when I click real close to the Player, but not when its far

rotund ginkgo
#

using A* pathfinding, I dislike how zombies group up around corners and want them to walk around eachother so they arent going in a single-file line. Would AlternativePath solve this?

jaunty raft
rotund ginkgo
#

ah yeah I thought AlternativePath did that itself

jaunty raft
#

dynamic graphs make pathfiniding optimizations very difficult.

#

(speaking in general... maybe your pathfinding system does it already)

rotund ginkgo
#

Id have 100+ units walking around too - yikes

#

How would I update the graph along the newly penalized path?

#

make bounds on the start/end points of that new path and pass that through UpdateGraph?

jaunty raft
#

you could make a local avoidance behaviour based on raycasts/collisions and only use pathfinding when actual navigation is needed

#

you could generate a small local navmesh around areas where agents coalesce and update only that and use secondary/local pathfinding on that

#

what you don't want is to calculate a whole new path on each update

#

i'd say overall local avoidance has many solutions and whats best depends on your particular game, there are many talks on yt from all sorts of developers on how they solved the pathing details in their games

rotund ginkgo
#

sorry still new to A* so correct me if im not understanding - I could create new smaller grids at these locations and update/scan those explicitly?

tribal agate
# rotund ginkgo sorry still new to A* so correct me if im not understanding - I could create new...

stepping back from the specific technical solutions for a moment -- there is a conceptual difference that's important to the problem you're trying to solve. There are two different things you need your units to do: pathfinding and steering.

Pathfinding: finding a route to get from point A to point B
Steering: deciding how to move at this very moment

A* is an algorithm for pathfinding, but it doesn't really tell you much about steering at all. The naรฏve version of steering is "move in a straight line directly toward the next point on the path that A* gave me," which is what you're probably doing right now.

#

you want your pathfinding code to run infrequently, but your steering code will run every frame

#

the pathfinding output is one input into the steering. Other input could include things like the positions of nearby agents, unit health, etc

rotund ginkgo
#

Awesome - tysm

hollow path
#

Does anyone know how to make an agent that moves like a car? I couldn't find the guide anywhere.

mystic thistle
#

Hey. I'm using navmeshagent in my 2d topdown game, and everything worked fine but suddenly SetDestination rotates the object by -90 degrees in X, which causes the sprite to go invisible and the 2d box collider to stop working. Any solution to that?

#

I've tried agent.updateRotation = false but it didn't help

stone owl
#

How do I give a route a safety check? Here you can see the AI changes cover if the player gets too close- but he is running right through the player to do so

#

sphere cast from the cover to the AI, if the player is between it's invalid?

#

that seems good enough I'll try, any other suggestions please @

stone owl
#
  • spherecast giving good results ๐Ÿ™‚
median marsh
#

Hi Guys, i'm having a difficulty here:
i'm using this part of code:
GetComponent<NavMeshAgent>().isOnNavMesh ;
which works perfectly with default setup on my agents -> type of Humanoid
but i have set other type of Agents with different parameters and if i use it, it simply never take the value of this bool,, i don't know why, and if there is a variant to write the code to get it to work

median marsh
#

This is what happens when i set my Agent Type of another thing that Humanoid

#

and when i set it back to humanoid

#

and i am not talking about collisions, which are really not what i espected

median marsh
#

doesn't work at all using others AgentTypeID.

median marsh
#

got it working

stone owl
#

that's an interesting way of doing it

#

at least I've never see it before.. what's going on with the blue circle is that a target?

wooden folio
meager moat
#

can anyone guide me as to where i might ask an A* pathfinding question?

rustic obsidian
#

Here

meager moat
#

thanks. I am attempting to create a couple small grids, at runtime, and they seem to generate, and are added to the Pathfinder/Graphs just fine. But i notice that the AI will only walk on which ever graph they are on when everything starts.

I do make sure to use AstarPath.active.scan, but alas, i can not seem to connect the different graphs. Is this possible?

meager moat
#

as eg: each one of these (see red x) is a very small grid.

but after all the grids are added and scanned.. something is still not right, as the path cant complete when its attempting to get nodes from other grids..

#

but the enemy can move aroudn their own little grid.

meager moat
#

ahh well i guess it just dont work. mmk. gnight all.

meager talon
#

Hello all, I am brand new to the NavMesh plugin. The following screenshot is the result of me baking the NavMesh. Will the fact its clipping through some of the floor debris on the floor model interfere with pathing? If so what is the best solution to fix? Use a flat ground?

meager moat
#

man, for official discord, sure seems futile looking for help here. well , cheerios.

alpine glacier
#

heya i have these waypoints position/show properly in my 2d project (i load them from another game from a txt file)

#

the "world" consists of the tilemap + edgecolliders (also loaded from that txt file)

#

how would i make bots use these waypoints? ๐Ÿค”

vast karma
#

how hard is ai to program?

#

i wanna know for the future

zealous mantle
#

It of course depends on your definition of AI.

stone owl
stone owl
#

if you need an AI to walk between patrol points, attack an enemy.. die.. it's incredibly easy and you could get that going after a 20 minute tutorial probably.

rapid sedge
#

Hey guys, quick question, while making a boss in a 2d game, I want to use behavior trees since I want the boss to have complex mechanic and using FSM would constraint me too much I wanted to know. Is it a better idea to code everything myself (freedom in my opinion) or to use a visual scripting tool (i.e Behavior Designer, way faster). What's your opinion?

stone owl
#

No need to lose the freedom writing things yourself.
A hybrid approach is best (when I say hybrid I mean really, anyone who knows what they're doing will be writing their own nodes anyway) of mixing built in functionality with unique nodes that fit your needs.

rapid sedge
#

Ok thanks @stone owl ! Much Appreciated!! I will look into that, I find the designer a bit expensive for now but I love the idea of combining things!

alpine glacier
#

im using the a* project free version

#

i forgot to take something in to account. if i make my ai's dynamic grid obstacles. the path finder which starts in their center starts finding jittery paths around it's own self

#

the thing i was to accomplish is just pathfind around other ai

alpine glacier
granite wedge
#

short question, what would be the best way to create a NavMesh during Runtime if you use a procedural generated map?

granite wedge
#

i think i found the problem. It seems the collectsources method can only be used on odd layermasks

stone sequoia
#

Ran across an issue with our navmesh. Where I drew the red lines, any time I spawn an agent there, they seem to teleport to the corners where I placed the green dots. Also, where I drew the blue line, they don't seem to cross at all. I've tried re-baking the nav mesh several times. As far as I can tell, the floor collider isn't somehow sitting higher than the navmesh itself. Everywhere else (so far) it seems the nav mesh is working fine. We're using 2020.3.25f1 with the built in nav mesh rather than nav mesh components. I am at a loss as to why this is happening so am asking if anyone else has any ideas

sacred kiln
#

Any idea why nav mesh breaks when I try to build on other parts of my terrain? (notably with the walls)

thorny pasture
#

so i have problem with navMesh baking

#

i have terrain with tree colliders but the navMesh seems to ignore them

#

how can i make it so it will make the trees as obstacles

wooden pawn
#

Why does he go beyond the purple mark?

severe fable
wooden pawn
#

โœ… Get the FULL course here at 80% OFF!! ๐ŸŒ https://unitycodemonkey.com/courseultimateoverview.php
๐Ÿ‘ Learn how to make BETTER games FASTER by using all the Unity Tools and Features at your disposal!
๐Ÿ‘‡
๐ŸŒ Get my Complete Courses! โœ… https://unitycodemonkey.com/courses
๐Ÿ‘ Learn to make awesome games step-by-step from start to finish.
๐ŸŽฎ Get my Steam Gam...

โ–ถ Play video
drowsy shoal
#

Are "navmesh building components" safe to use for a full project?

#

I don't really have plans on updating the Unity engine because I don't really need to, but still if there's some really wonky bugs from this package I'm not aware of I don't really want to use it lol

silent crest
#

Need Help.
Let's say i have an enemy running on a custom made Behavior Tree.
Now when it get's attacked i would like to abandon the current sequence and go to the hurt sequence.
How do i go about doing that?
In essence i want to know how to make the behavior tree react to events

lyric moth
#

Has anyone here ever implemented an influence map for an RTS game? I get the theory behind it but I dont get how to translate the actual influence map into commands for the ai

real meadow
#

The stopping distance of my zombie agent is not working - I have been using agent.SetDestination(Player.position); but it keeps walking into the player even with stopping distance

#

Can anyone help?

#

I might try and re do the animation because it worked before that

real meadow
#

what on earth? the agent runs past the player before running around in circles with the player in the middle? Can anyone help me fix this?

eternal stag
#

what stoping distance did you put?

real meadow
#

2

pastel grail
#

hey, I have an interesting scenario that I'd love a hand with: I'd like my agents to avoid skirting close to walls when possible (as it looks a bit more natural), but they still need to be able to get into tight spaces when necessary. My solution has been to bake both a "tight" navmesh and a "loose" navmesh, where the tight one hugs walls and the loose one is a bit further away. I can think of a few hackier solutions from here, but the easiest & most convenient method would be if I could simply set the "tight" navmesh to have a higher cost, so agents would avoid it unless necessary. The problem is that the loose navmesh is fully inside of the tight one -- it overlaps at every point, so it's always more expensive to travel across the area where the two navmesh costs add together, no matter what the costs are set to (unless i misunderstand how overlapping costs work). that's obviously the opposite of what I want! is there any way around this? some way to "subtract" the area of the loose mesh from the tight one?

real meadow
#

it does not stop at all

#

The higher the stopping distance the greater the radius the agent runs?

pastel grail
#

here's an example of my testing area: yellow is the tight navmesh, blue is the loose one (although it's really both, since they overlap)

#

these are both NavMeshSurfaces, by the way -- not sure if that's relevant

wise bone
#

I made a nav mesh enemy but it seems to just immediately clip through the floor. how could i fix that? i have baked mesh data.

tribal agate
wise bone
agile sapphire
#

How would I generate a navmesh allowing for these two to connect?

alpine glacier
#

Try making the agent radius smaller or decrease voxel size in the navmeshsurface then rebake

velvet radish
#

Working on a player mining a block and making AstarPath recognized it gets removed

AstarPath.active.AddWorkItem(ctx =>
{
    var gridGraph = AstarPath.active.data.gridGraph;
    var node = gridGraph.GetNearest(new Vector2(xPos, yPos)).node;
    node.Walkable = true;
    gridGraph.CalculateConnectionsForCellAndNeighbours(node.position.x, node.position.y);
    ctx.QueueFloodFill();
});
```It does make it walkable... but then it errors on calculating the connections. So error is with `CalculateConnectionsForCellAndNeighbours`
I've tried switching the arguments between the node's position and the xPos/yPos variables I have... I cannot seem to figure it out.
eternal stag
#

what's the error

velvet radish
#

ok. i made some progress.

#

I just changed that long CalculateConnections function's arguments to the xPos and yPos.
It works when i remove a block that is generated by the world..
but when i place a block and remove it... the connections arent properly calculated..

#

so i suppose my issue relies in the function where i place the block.

pure schooner
#

how do i stop my navmesh agents getting caught on the edges of the navmesh?

eternal stag
#

Ask them nicely

pure schooner
#

i will do that <3 ill write them a nice comment

stone owl
pure schooner
#

I will do soon

#

I'm using navmesh and terrain it's quite frustrating :(

stone owl
#

ah terrain, that can be tricky

#

showing the navmesh gizmo over the terrain will help.

pure schooner
#

I can't seem to turn off the navmesh generation and have it generate from the prefabs, all the trees generate pretty jagged edges so things get stuck on them a bit

#

will do

unreal shuttle
#

Why does my AI clips on walls and obstacles? I already set up the colliders and stuff

opal furnace
#

Hi, I am Unity user from 4 years ago and I wanna start a healthy debate:

#

What is the best Unity AI course to program NPCS?

#

I took a few of them, maybe the most complete the Penny course, available in Unity Learn, but her way of programming is a bit confusing, so I have problems accessing from other objects to the variables of her scripts.

#

Any great AI course to use it as default system for npcs?

opal furnace
slate yacht
#

Hi, im new to ai and algorithms, is there a simple algorithm or ai to fix my enemies clutter up like this?

wide forge
#

Hi,I created a realistic 3d Airplane controller, and now I want to use this controller and an ai script to follow a player. How can I do that? Thanks for your help!

opal furnace
wide forge
#

Thanks

jaunty raft
# slate yacht Hi, im new to ai and algorithms, is there a simple algorithm or ai to fix my ene...

Boids is an artificial life program, developed by Craig Reynolds in 1986, which simulates the flocking behaviour of birds. His paper on this topic was published in 1987 in the proceedings of the ACM SIGGRAPH conference.
The name "boid" corresponds to a shortened version of "bird-oid object", which refers to a bird-like object. "Boid" is also a ...

next stream
#

My ai gets stuck in terrain any help?

sleek jacinth
#

How hard would it be yo make an enemy lile in dark souls

#

Lile when do the enemy attack guard or reposition

jaunty raft
#

Pretty much as hard as it gets.

sleek jacinth
#

Oh no

marsh lintel
#

Hello guys, has someone ever created a 2d graph with a* pathfinging via script?

#

I don't know how to set the 2D physics propriety in the code, I can't find any

stone owl
#

a lot of smoke and mirrors - you're not building a real robot with intelligence you're faking it!

queen needle
alpine glacier
#

i generate a random point. The Ships standing after they move and they can not reached the point. But how i can check that the point can not reach ? I do many thinks from the unity dokumentation but nothing help

#

For better understand a better overview. I dont kow how i can remove the Navmesh inside a terrain then my problem was easy to fix ๐Ÿ˜„

queen needle
#

Is possible to install navmesh in Unity v2021?
I'm trying to install, but always I got an error :/

queen needle
alpine glacier
#

I'm also using NavMeshComponents to generate the NavMesh

#

The infinite loop starts at the PathUtils.FindStraightPath call

alpine glacier
# queen needle

If you make a empty Game and load it There , is there the Same Error?

ember otter
#

Is it possible to force NavMeshAgent to ignore a specific NavMeshObstacle?

alpine glacier
#

I'm making an ai for my game and was wondering how performance heavy the navmech is in larger scenes. I couldn't find any solid info on this so that brought me here

leaden sable
#

Hello all, I am implementing a utility AI solution for my ai fighter people in a sort of simulated fps game where AIs fight each other. I'm trying to wrap my head around how to handle their weapon actions like shooting, swapping weapons, and reloading, while also handing their movement actions, like standing, crouching, or running for cover. I want them to be able to do their weapon actions while also moving, but sometimes the movement might be dependent on which weapon action they're taking. For instance, if they are reloading, running for cover might make more sense. I'm really new to Utility Ai though so does it make sense to keep these systems separate even though they may rely heavily on each other? Or would it make more sense to put them into one set of actions?

real sonnet
#

Yep, locomotion should definitely be its own separated system

leaden sable
#

Yes that will probably be best. Thanks for the input ๐Ÿ˜„

real sonnet
#

You'll be even more convinced when you introduce more systems than attacking later on ๐Ÿ™‚

leaden sable
#

Do you have any advice for keeping these two systems synced? I want to avoid a situation where for instance the movement system decides to move the fighter forward to take a shot, but then the shooting system decides to reload. How can I ensure these systems are always on the same page?

#

I guess I could always throw in more considerations for my movement actions, but at some point it will start getting bogged down. Like if my "move closer" action has to check all of the considerations for the "take a shot" action, that might become redundant

real sonnet
#

You would sample available positions in the agent movement range, and add as many considerations as you need under one single action. The scoring system will prioritize based on paramaters that you will spend a lot of time tweaking, but in the end there's only one source of truth for picking the best desired position. So I don't see any conflict per say, just maybe some balancing headache

real sonnet
#

i.e. get closer and find cover

#

i just sample positions and score them, I'll pick the best whatever it means for my game/agent (the considerations) if the end position ends up being one behind cover because it scored a high priority, then so be it, the agent will now move behind cover

leaden sable
#

Oh ok so you have just one "change position" action that does all of it?

real sonnet
#

if he's comfortable being in the open (maybe he's more brave), so be it

#

yes, only one "move to" action

#

I can still imagine multiple actions where they all compute their own desired vector that you add up in the end (like you would do for Boids if that makes sense to you), but never went that far

#

actually in this case your agent could be stuck between 2 places and never commiting to one, lik you were afraid in the beginning so maybe not a good idea

leaden sable
#

AI is difficult... There is so much to consider lol

real sonnet
leaden sable
#

What makes matters worse is that my maps are dynamic so it's not really a given what could be cover and what is not.

real sonnet
#

Buridan's ass is an illustration of a paradox in philosophy in the conception of free will. It refers to a hypothetical situation wherein an ass that is equally hungry and thirsty is placed precisely midway between a stack of hay and a pail of water. Since the paradox assumes the donkey will always go to whichever is closer, it dies of both hunger and thirst since it cannot make any rational decision between the hay and water.[1] A common variant of the paradox substitutes two identical piles of hay for the hay and water; the ass, unable to choose between the two, dies of hunger.