Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
3
Question by brentshermana · Aug 03, 2015 at 05:42 PM · 2dcollider2d2d-physicspolygon collider 2d

Polygon Collider 2D: prevent automatic generation

Hi Folks,

When I add a polygon collider 2D component to my GameObject, it automatically forms a shape roughly equivalent to the shape of my sprite, but I'd prefer to create it myself from scratch. How do I prevent the auto-generation from happening, forcing me to delete each individual vertex manually?

Thanks for hearing me out :)

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 OrbitGames · Aug 03, 2015 at 06:31 PM 0
Share

Try adding the collider before adding the sprite

avatar image brentshermana · Aug 03, 2015 at 09:12 PM 0
Share

That's a nice workaround, but is there any other way?

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Hexer · Aug 03, 2015 at 09:25 PM

You can use the Edge Collider 2d component. This enables you to edit the vert points to your wishes (basically lets you make your own collider from scratch)

(It starts as a straight line but you can edit the length of it by just dragging and you can click to create more verts and move these verts), This way you reduce the total amount of verts and edges. I find this way better than the polygon2d component.

http://docs.unity3d.com/Manual/class-EdgeCollider2D.html

Comment
Add comment · Show 2 · 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 brentshermana · Aug 04, 2015 at 02:12 AM 0
Share

I played around with it a little myself and wonder why anyone uses the polygon collider at all! Thanks for your answer.

avatar image Eric5h5 · Aug 31, 2015 at 11:01 PM 0
Share

Because an edge collider can only be a continuous edge, whereas a polygon collider can have multiple separate shapes, including holes. Try making a donut shape with an edge collider, for example. (Hint: you can't. ;) )

avatar image
8

Answer by seanybaby2 · Aug 31, 2015 at 09:07 PM

If you want to use a polygon collider and not an edge collider, there's actually a simple work around. Just attach your polygon collider to the game object BEFORE you add the sprite. Then add the sprite. The polygon collider won't readjust itself to match the sprite and now you can adjust the polygon collider as you like. :)

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 Mmmiles9000 · Aug 03, 2021 at 06:05 PM 0
Share

Thanks for this clever workaround.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

PolygonCollider2D edit problem 1 Answer

What is the equivalent of PolygonCollider2D.points for CompositeCollider2D? 0 Answers

Scaling colliders up and down over time 1 Answer

Moving colliders that are part of a composite collider 1 Answer

Collider lets object through 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