Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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
0
Question by darshie1976 · Jan 16, 2016 at 04:25 PM · pathfinding

AI agent that wait to reach the first destination before going for the second

I am learning how to use the Unity integrated pathfinding functionality.

I have an agent and I would like to see it changing position, based on a set of action that it should perform. For example; it will be idle, then move to position X to perform an action; then move to position Y to perform another action and so on.

So far I did use the example included in the standard assets; where the agent has an AI script that accept a transform from an object in the scene; which is great as starting point.

I did add a second target, and a second set of commands, so after that the destination has been set to target 1, and the move is issued, I set destination to the second target, and then issue another move statement. The problem is that the agent does not reach the first point, and then go to the second; it go straight to the second point. I suppose that the code goes so fast, that as soon as the agent is moving to the first point, the code is already changing the destination to the second point, so the agent goes straight for the second point.

Is there a way to have the agent get to a destination point (and maybe wait there for a specific amount of time), and then move to the second?

Comment
Add comment · Show 2
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 darshie1976 · Jan 14, 2016 at 10:07 AM 0
Share

Found a property called Pathpending; which seems to hold data if the destination hasn't been reached. I will try to use its output to evaluate if the destination has been reached; and once that will happen, I will change the destination to the next object in the list.

avatar image vintar · Jan 16, 2016 at 05:02 PM 1
Share

Im not familiar with the code in the example, but Im pretty sure there is a distance check to see if the agent is near his target point before he can be assigned the next. Check if the distance set is maybe too big, or your points are too close together, or you have changed the code and broken something. Really cant tell for sure without being able to see it.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by darshie1976 · Jan 17, 2016 at 03:19 AM

Yes, the distance check is done by pathpending: it return the distance of the agent from the target destination.

I was able to get teh agent to move between points; although it seems to not be able to sync up with the animation when I call the move; but that's a different story.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Make an object move from Point A to Point B then back to Point A repeating 9 Answers

What is the easiest way to enable 2D isometric grid-based pathfinding? 2 Answers

2d NPC pathing 0 Answers

How to exclude certain navmesh obstacles on runtime? 2 Answers

A* Pathfinding Issue 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges