• 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
Question by Endogeny · Mar 04, 2020 at 12:56 PM · colliderspathfindingastar

Inaccurate A* Pathfinding Scan!

Hi, I've been trying to implement A* pathfinding but it is having trouble in accurately scanning the colliders in my scene. The background should be entirely filled with blue squares but it is not due to some issues with the tile colliders. The pathfinding component is using 2D physics and the diameter for the circles is set to 1. However, it doesn't seem to produce better results if I decrease the number to 0.99 or 0.98. alt text

Below is the image of the platforms and its colliders. They have been set to the ground layer and are the only objects in the scene on the ground layer. I'm at my wit's end with this and would appreciate any and all help!

alt text

unityproblem.png (156.1 kB)
unitycolliders.png (117.1 kB)
Comment

People who like this

0 Show 6
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 TreyH · Mar 04, 2020 at 01:25 PM 0
Share

It looks like your system is blocking off anything within 1 cardinal square of a impassible square. As there isn't an A* built into Unity, you might need to post some relevant code for anyone to help you further.

avatar image Endogeny TreyH · Mar 04, 2020 at 01:40 PM 0
Share

Hi, thanks for commenting. I imported an A* Pathfinding package from https://arongranberg.com/astar/download. At this point, there is no code because the A* scan is not accurately deciphering a proper grid in the first place. I'm not sure why it sees some cells as obstacles even when the tile colliders are fairly accurate.

avatar image TreyH Endogeny · Mar 04, 2020 at 02:28 PM 0
Share

Well, are there other Collider types maybe? You might not want Circle, but maybe there's a Rectangle option?


The Answers site isn't super great for extended discussion or something like "hey I downloaded some code from the internet and it doesn't work", but we will try within reason.

Show more comments
avatar image unity_kzJdvDjwj0IrSw · Mar 22, 2021 at 03:27 PM 0
Share

Hi Endogeny!

Did you ever find a solution to this problem? I'm encountering the same exact thing and since it has been a while since you posted I thought that maybe you figured it out. I tried playing around with my composite collider but to no avail.

3 Replies

· Add your reply
  • Sort: 
avatar image

Answer by Cratuss96 · Dec 27, 2020 at 02:47 AM

its because of the composite colider. The Composite collider has a verrrrrrryyyyy small offset of (5e-07). Thats why it often messes up float numbers. If you deactivate the composite then it should work fine. btw i love that you use the same tileset "kings and pigs" as i do

Comment
Llama_w_2Ls

People who like this

1 Show 0 · 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

Answer by MarshCZA · Mar 04, 2020 at 02:55 PM

As a sanity check have you tried a much smaller diameter, like 0.1?

Comment

People who like this

0 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 Endogeny · Mar 04, 2020 at 03:07 PM 0
Share

Anything below a diameter of 9.8 just doesn't register any obstacles :( thanks anyways

avatar image

Answer by Spaceshark123 · Jun 23, 2021 at 01:57 PM

@Endogeny I have had this problem personally with my tilemap and composite collider and the fix for it is to change the composite collider geometry type to polygons and regenerate the A Star navmesh scan.

Hope this helps! ,@Endogeny I have had this problem personally with my tilemap and composite collider and the fix for it is to change the composite collider geometry type to polygons and regenerate the A Star navmesh scan.

Hope this helps!

Comment

People who like this

0 Show 0 · 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.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

133 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 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 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

How to make enemies take wider routes? 1 Answer

Force a scan with A* Pathfinding 2 Answers

GridGraph A* : how to verify if a point is attainable and how to use different graphs for different agents 0 Answers

How to utilize A* pathfinding 1 Answer

Can i use A* pathfinding on planes? 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