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 SilentSin · Nov 29, 2013 at 11:02 AM · 2dgridconcavecollid

Concave PolygonCollider2D

I'm making a 2D grid based platformer and I need to generate colliders based off the terrain data.

I can't just use a BoxCollider2D for each grid space that contains a platform because the corners of the boxes collide with the player and cause them to bump rather than move smoothly across the surface.

So I've come up with a way to generate a polygon collider that matches the platform's shape perfectly, but I've run into a problem.

The problem occurs when the entire platform is convex (I don't mean the shape contains convex parts, that's fine, I mean when the entire platform forms a convex shape). For example:

  • Imagine a large square level filed with air in every call except for the edges, which are all platforms.

  • If you were generating a 3D MeshCollider, you would give it a quad for the floor (facing up), a quad for the right wall (facing left), a quad for the roof (facing down) and a quad for the left wall (facing right). The result would be a bounding box to keep everything inside the level.

  • But to make a PolygonCollider2D, all you have to do is specify the points. So you give it the bottom left, bottom right, top right and top left. The problem is that it interprets those points as a convex shape and makes a square out of them rather than an inside-out bounding box type shape.

I'm trying to come up with a more complex terrain generation algorithm that takes this problem into account, but I would really appreciate any help people can give.

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

0 Replies

· Add your reply
  • Sort: 

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

17 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

Related Questions

Highlighting tiles on a hexagonal grid 1 Answer

In 2D. Is there a way you can set the size of an object to fit the grid perfectly? 1 Answer

Grid Based Block Generation 0 Answers

What to do with "unloaded" gameObjects? 1 Answer

Generating grid pattern 2d 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