• 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
0
Question by mark 1 · Jul 20, 2010 at 06:31 PM · gameobjectdistance

Shorest distance around a gameobject

http://skitch.com/mpollard/dpcf1/skitched-20100720-183004

I have a game which uses a touch event to move trucks to a station though a array of vectors. The main problem is when you want to park a truck into the station, the station will have only 1 way in so if you drag to the "this point" i want to be able to work out how far each way around to the enterance it is and pick the shorest way in.

Any help in achiving this?

Thanks in advance

Comment
Add comment · Show 1
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 qJake · Jul 20, 2010 at 06:37 PM 1
Share

Without knowing more about what the world looks like and what kind of pathfinding system you're using, we probably can't help you.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by fherbst · Jul 20, 2010 at 09:09 PM

I can only make some assumptions and hope that they are correct...

"move trucks to a station through an array of vectors" - you have some kind of nodes and edges your trucks can drive between (streets and street corners)? And your truck is at one node, while the station is at another node?

If thats what you mean, than you may want to take a look at http://en.wikipedia.org/wiki/Shortest_path_problem. Some of the algorithms named there are also to be found as ready-to-use scripts in the unifycommunity, but they are probably overpowered for your problem (they are more thought for things like NPC movement without restriction to streets like your trucks).

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

grab all game objects with a distance of the object? 2 Answers

OnMouseOver Distance Measuring 1 Answer

Disabling GameObjects With A Tag That Are More Than A Set Distance From A GameObject? 2 Answers

How to apply explosion/magic/grenade damage to detect objects (enemies) within a given radius, and apply AOE damage to each enemy based on its distance? 2 Answers

Distance an object has travelled over a certain time? 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