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 raxod502 · Jul 18, 2014 at 03:34 PM · physicsmeshcollidertilepolygon collider 2d

How to get a 2D polygonal sprite to collide with a Mesh Collider

This is a rather simple question. I have a 2D sprite that really needs the precision of a polygonal hitbox. The 2D, tile-based world around it uses a tile Mesh for efficiency reasons, and thus has a Mesh Collider.

Before, the tiles in the world were each GameObjects with Box Colliders and Rigidbody 2D's, and the ship and the tiles collided just fine. Now that I am using a Mesh Collider, however, they cannot collide. (I have read that this is because one is 2D and one is 3D.) So what should I do to get collisions (preferably with rigidbody physics) between a polygonal ship and a 2D tile mesh?

(Here is the collision mesh I am using.)

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
2

Answer by Kiwasi · Oct 17, 2014 at 10:17 PM

To surmise the comments to this question

  • Meshes are 3D. Polygons are 2D. They exist in separate physics systems and cannot collide.

  • Polygons are the 2D equivalent to a Mesh

  • Using a polygon collider is the best option

Also worth noting that you can edit a polygon collider dynamically by using SetPath. This should give you all of the functionality from your mesh.

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 Pecek · Jul 18, 2014 at 04:58 PM

The physics engines aren't compatible, use 2d/3d colliders only.

Comment
Add comment · Show 8 · 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 raxod502 · Jul 18, 2014 at 05:13 PM 0
Share

But there is no Polygon Collider 3D. I don't want to use a box collider.

avatar image Pecek · Jul 18, 2014 at 08:20 PM 0
Share

I don't understand the problem, if you want to use 2d physics, then use 2d colliders only, if you want 3d, then use 3d colliders, there is no workaround since they are completely independent from eachother.

avatar image raxod502 · Jul 18, 2014 at 09:15 PM 0
Share

The problem is that among the list of colliders in the Physics section, I can only see Box, Sphere, Capsule, $$anonymous$$esh, Wheel, and Terrain. None of these would be precise enough for my needs, unless I used three or four (at least) per sprite. I am looking for a 3D analogue to the Polygon Collider. Otherwise, I am looking for a 2D analogue to the $$anonymous$$esh Collider. Since I need to use both of these, I need to find an equivalent for one of them — but it doesn't seem like those exist.

avatar image Pecek · Jul 18, 2014 at 09:45 PM 0
Share

Polygon collider is the 2d equivalent of the mesh collider. What are you trying to do exactly? Can you post an example image?

avatar image raxod502 · Jul 23, 2014 at 01:36 PM 0
Share

Alright... so I have a two-dimensional ship, as seen here, which collides using a Polygon Collider 2D with the bricks also shown there using Rectangle Colliders 2D. Now, however, I have to change the blocks to use a $$anonymous$$esh Collider, as seen here. Since Polygon Colliders and $$anonymous$$esh Colliders do not work together, I need to change something. I tried using other solid colliders such as these; however, this was tedious and played horribly. So what, specifically, should I do to retain the precision of a polygon collider and the speed of a mesh? From your previous posts, I might infer that I can use a mesh collider in place of a polygon collider, but I don't know how to do this. (Is there any documentation?)

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity 5.0 and alternative for triggering complex meshes. 2 Answers

Need help with a relatively simple issue. 1 Answer

Non-Convex Mesh Collider triangle limit - is it more than 255? 0 Answers

Im using the 2d wave mesh asset..how do I make an object float on the wave? 0 Answers

Rigidbody slowly falling through mesh collider 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