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 /
avatar image
2
Question by testure · Jun 25, 2011 at 05:58 AM · unitysteer

UnitySteer - any way of determining when you've arrived at a node?

I'm aware of setting the OnArrive delegate- but that only tells you when you've arrived at your target. I'm using SteerToFollowPath, so I give it an array of nodes. Currently, OnArrive only fires when it reaches the end of the entire path. I need some sort of way to determine if I've arrived at an individual node (for AI behavior reasons).

Before I implemented UnitySteer, I was simply checking the SqrMagnitude difference between the next nodes' position and my AI's position.. if it was within the 'arrival' distance that I'd set up, it would fire an event.

However, now that UnitySteer is avoiding obstacles (beautifully I might add), it's obviously steering the AI off the path. The problem is that my previous logic no longer works, because as soon as the AI leaves the path, it never knows that we've skipped several nodes to bypass an obstacle, so my arrival events never fire.

UnitySteer is always aware of the next point in the path, and it's constantly steering for it- so it must have some sort of internal method of determining what node it's currently at, and which node it should be heading for.

My next step is to dive into UnitySteer and see if I can't reverse engineer the mechanics behind path traversal, but I figured I'd post here in case somebody had some insight that could save me a bit of digging.

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
2
Best Answer

Answer by testure · Jun 27, 2011 at 04:15 AM

Ah, another question with no replies. sad, sad...

Anyway, for those interested- There is no way to determine when you have arrived at a node when you're using SteerToFollowPath. I guess the nature of the vehicle behavior is that if it misses a node, it simply starts heading to whatever is the easiest to get to- so it doesn't actually have any concept of 'nodes'. It actually seems to keep track of segments, however.. and that you can actually determine that using one of Pathway's methods:

 var tStruct = new PathRelativePosition ();
 Debug.Log("We are on segment " + tStruct.segmentIndex);

From my testing though, it's pretty unreliable as a method for figuring out when you've hit a node. One would think that you could just detect when the segmentIndex changed, subtract one, and then there's your node index. That's not the case though- I'm not sure what's going on behind the scenes, but SteerToFollowPath actually changes segments a pretty good distance away from the node that would mark the start of that segment (as far as 8 meters away in some of my tests). I'm assuming that it has something to do with some internal prediction, but either way- it's not useful for my purposes.

I ended up just using SteerForPoint, and using the OnArrival delegate to increment the path on my own. It's not as fluid looking as SteerToFollowPath, but I suppose that's the trade-off.

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 quitebuttery · Jul 30, 2015 at 08:00 AM 0
Share

Same here. I wrote my own class which uses arrival to advance points on a path. It's not really a bad solution and works quite well.

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

2 People are following this question.

avatar image avatar image

Related Questions

how and where can i download unity steer? 3 Answers

Unity steer for 2d game 1 Answer

Unitysteer 2.0 force output Vector 2 Answers

animation doesn't work??? 1 Answer

Integrating unitysteer with mixamo animation scripts 1 Answer


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