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
0
Question by Jovssen · Apr 18, 2018 at 12:28 PM · polygoncollider2dtriangulation

What polygonization algorithm does unity use for PolygonCollider2D?

It doesn't seem to be bayazit (which farseer uses) because they produce different results.

Wish the source code were available to see

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · May 08, 2018 at 10:39 PM

Unity uses Box2d as 2d physics engine. Also what is a "polygonization algorithm"? Since the input is a polygon, what do you think the output should be? A collider is not a mesh and need to be triangulated

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 Jovssen · Sep 06, 2018 at 11:20 AM 0
Share

Sorry for replying late. Box2d (which farseer is based on) can't work with concave polygons (it actually creates a convex hull whenever you give it vertices to make a "polygon" shape class (other such are "circle", "edge" classes) out of (which is then used to create a "fixture" class, which attaches the "shape" to the rigidbody)), so it decomposes them to convex polygons (you can see with a polygoncollider2d, it makes extra lines if the polygon is concave, that is how unity has polygonized it).

Farseer comes with a utility script that decomposes concave polygons to convex polygons (so that we can attach them to rigidbodies with shapes and fixtures as several convex polygons, a "composite collider"). The algorithm in farseer is called bayazit. I tested the results from bayazit, and looking at the polygoncollider2d in the scene view with the same input vertices, and the convex subpolygons were different between them; the 2 algorithms sliced up the concave polygon differently.

avatar image
0

Answer by TanselAltinel · May 08, 2018 at 12:08 PM

Is this a question or a wish from Unity?

Unity source code is available for read-only purposes: https://github.com/Unity-Technologies/UnityCsReference

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 Jovssen · Sep 06, 2018 at 11:26 AM 0
Share

Sorry for replying late, but the code they made public is only the c# code, whereas most of Unity code is written in c++, as well as their polygonization (I already looked). I was looking to try their algorithm in straight comparison to see the speed difference between the one Unity uses and the one that comes with Farseer (based on box2d) called Bayazit. I really needed speed for my polygonization.

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

79 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

Related Questions

Automatically generating the triangle list for a mesh 0 Answers

2DTerrain Problem with Pollygon Collider 2D 0 Answers

3D Meshes: how to minimize error during reduction of order? 0 Answers

Having some issues with Unity inbuilt rigidbody collision physics. 1 Answer

Triangulate a polygon 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