Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by jessee03 · Aug 20, 2012 at 02:28 AM · ai

Ai pathing through a maze

I was wondering if anyone knows the best way to path an enemy through a maze to find the player. I can easily make the enemies walk towards the character when in range but they will get caught up against the walls. Any way to draw a path leading the shortest distance through the maze to the character that the enemy can follow?

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 Khada · Aug 20, 2012 at 07:36 AM 0
Share

This is achieved via unities built in pathfinding: http://www.youtube.com/watch?v=$$anonymous$$YRl4D-jTsY

Griffo has linked a page about it.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by sparkzbarca · Aug 20, 2012 at 05:35 AM

the simplest is probably what is known as A* algorithm. Basically you divide the map into a grid and move from one square in the grid to the next.

If your wanting to learn programming writing a simple AI pathfinding program yourself is an excellent way to learn. If your good at it already and simply want pathfinding you can get versions of it off the asset store (not sure if there is a free version)

if you want to implement your own (takes some time certainly)

http://www.policyalmanac.org/games/aStarTutorial.htm is a good start to understanding how pathfinding is done.

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
avatar image
0

Answer by Eric5h5 · Aug 20, 2012 at 03:57 AM

See here for one possibility. It uses an array to represent the world and a flood-fill algorithm for pathfinding.

Comment
Add comment · Show 6 · 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 jessee03 · Aug 20, 2012 at 04:31 AM 0
Share

Would this work for a 3d environment?

avatar image Eric5h5 · Aug 20, 2012 at 04:52 AM 0
Share

Yes, even if the maze is "3D" it's likely to be really 2D, just presented in 3D. If it's real 3D, you're probably better off with some other technique.

avatar image jessee03 · Aug 20, 2012 at 04:55 AM 0
Share

I would rather not use an array for this. Pretty much just want to create a path around objects from one location to another.

avatar image Eric5h5 · Aug 20, 2012 at 04:59 AM 0
Share

You have to use an array of some kind, even if you use some other algorithm like A*. The "just creating a path around objects" part involves arrays no matter what.

avatar image jessee03 · Aug 20, 2012 at 05:02 AM 0
Share

Ya I guess you're right. Just have to figure out how to create a group of locations that the enemies have to follow from point A to B without encountering walls. I do have a grid based spawning system but I don't currently keep track of each location with an array.

Show more comments
avatar image
0

Answer by Griffo · Aug 20, 2012 at 06:51 AM

What about this ..

http://docs.unity3d.com/Documentation/Manual/NavmeshandPathfinding.html

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 jessee03 · Aug 20, 2012 at 07:28 AM 0
Share

It's pro only

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

12 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

Related Questions

Visible GameObjects for AI 0 Answers

Follow up to AI Pathfinding Question 0 Answers

How to forbid an NPC to move diagonally using Character Controller? 1 Answer

Shooting AI problem 2 Answers

How to remove z axis control from script 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