• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by Prefab · Jun 23, 2016 at 02:51 AM · navmeshmoveobstacleagent

How to prevent stationary ai agents from being pushed by moving agents?

I have several triggers positioned around the scene which ai agents try to navigate to via Unity's navmesh. Each agent has a collider and kinematic rigidbody attached so that it can interact with the triggers. When an agent reaches the center of the trigger they enter a specific state in which they are stationary for a random period of time.

The problem I am getting is that other non stationary agents can bump into them and push them out of the trigger. And when the agent is pushed out of their trigger they are no longer in position and their stationary state gets cut short. The moving agents have logic which naturally steers them away from stationary agents, but sometimes when there are too many agents in the same spot, or several are moving towards the same target, they can still end up colliding. I would need to make the stationary agents completely immovable by other agents and the player (also a rigidbody and collider setup).

So far I have tried changing the agents radius to almost zero when inside the trigger, but this allows moving agents to pass straight through the stationary agent and in some cases allows multiple stationary agents to stand on top of each other, or rather inside each other. I have also tried enabling a navmesh obstacle around the stationary agent (like a wall around them), to shield them and let the moving agents know that they have to move around this trigger. This works, but it's possible for moving agents to just happen to be in the same position as the navmesh obstacle, and so when the obstacle gets enabled the moving agents will unrealistically snap away from it. This looks quite glitchy. I have also tried to play around with the agent avoidance priority, by increasing it greatly for the stationary agents, but this didn't seem to make much difference.

So my question is how to make the stationary ai agents completely immovable by other agents and the player?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by BaronWhite · May 01, 2018 at 08:22 AM

Don't know how you ended up fixing up, setting the priority of stationary agents to 0 (highest) helps a bit.

There should be a way to "root" the agents as if they were obstacles. And the workaround for this is having a navmesh collider component which you would enable whenever they are stationary.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image hydraorc_unity · Oct 27, 2020 at 04:20 PM 0
Share

Is it possible though for a multiplayer game to play with priorities in a way to make sure that you can only push your own units and can not push enemies and the opposite for your real-time opponent so he can only push his own units but not mine?

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

60 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Update the navmesh after carving 1 Answer

Why my second NavMesh Agent can't find the NavMesh? 1 Answer

Issue updating NavMesh code and Agent. 1 Answer

using Navmesh or ML Agent ?! 0 Answers

NavMeshAgent freeze for a moment 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges