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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by Croolsby · May 04, 2015 at 10:06 AM · 2dmesh3dproceduralmeshcollider

Convex Mesh Collider on Procedurally generated mesh does not conform..

I want to have 2D, planar, convex polygons (like paper) in a 3D space. I also want them to be rigidbodies with colliders. I have a Mesh Collider on them, and after they have had their mesh generated, I do GetComponent().sharedMesh = mesh. The problem I have is that if the Mesh Collider is not set to convex, I get an error saying Unity 5 doesn't support non-convex collisions anymore. I know all my polygons will be convex, so I set GetComponent().convex = true. However, when I do this, instead of using the sharedMesh, Unity places a crude bounding box around the polygon and uses that as the collider (see the green box around the polygon in the image).

alt text

I can't use this because the bounding box encloses too much empty space, so the mesh would "collide" even though it's no where near actually colliding.

Before I go writing my own collision detection system, I want to know if Unity can do this properly. I've looked at the Quad and Plane objects. Those are 2D planer convex polygons, and they have properly fitted colliders, so you would think Unity could do properly fitted colliders on other 2D shapes (besides rectangles) out of the box. But how? I tried procedurally generating a plane, applying a mesh collider with the convex box ticked, and it still gave me a collider that was bigger than the actual mesh.

meshcollider.png (45.4 kB)
Comment
Add comment · Show 1
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 Sparty · Sep 25, 2015 at 02:44 PM 0
Share

Any solution Croolsby? I am facing the same problem at the moment =(

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by nickeeromo · May 29, 2015 at 09:17 AM

I know I won't be much help, but I had a similar situation, only with using a quad. For your shape, if it is 2D, a mesh collider simply won't work properly FOR SOME REASON unbeknownst to me. Every place I look, they tell me to use a box collider, but that is just for a normal 2D shape like a quad. Now, if your shape is not a plane or quad but still 2D, don't know enough on my own to help you, but these may help:

A reference: http://forum.unity3d.com/threads/why-is-mesh-collider-so-large.152254/

Little outdated but may still be helpful: http://answers.unity3d.com/questions/330315/scaleing-the-mesh-collider-1.html

If nothing else you might consider using a compound collider to approximate the shape. More on that here: http://docs.unity3d.com/Manual/class-BoxCollider.html

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

2D collider wont collide with mesh 0 Answers

3d collider mesh to 2d collider mesh 0 Answers

Best approach for collision in shape combination game? 0 Answers

MeshCollider is not getting updated when adding vertex to mesh 1 Answer

Trouble with Inaccurate 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