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 Fran · Mar 10, 2010 at 02:39 PM · collidermeshcombinemeshes

Why mesh colliders doesn't work with combined meshes using Mesh.CombineMeshes?

I have a bunch of meshes combined into a nice mesh using Mesh.CombineMeshes, to that mesh I add a mesh collider and it doesn't collide at all!

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

3 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by naruse · Mar 16, 2010 at 11:31 AM

Try so set the Convex flag. Some mesh Colliders wont work depending on how the mesh is defined.

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
1

Answer by Vorda · Mar 16, 2010 at 06:37 PM

Had the same problem yesterday, had two meshes using for colliders, separe work perfectly combined wouldn't work. My colliders once combined also didnt show the greenish collider outline in scene view after combining any more.

My fix was using Mesh.Optimize, after combining:

combineInstances.Clear(); CombineInstance cmb = new CombineInstance(); cmb.mesh = colisionMesh; combineInstances.Add(cmb); cmb = new CombineInstance(); cmb.mesh = walkMesh; combineInstances.Add(cmb);

 Mesh col = new Mesh();
 col.name = ModelName + "_C+W";
 col.CombineMeshes(combineInstances.ToArray(), true, false);
 col.Optimize();
 Debug.Log("$3");
 //foreach (CombineInstance c in combineInstances)
 //    UnityEngine.Object.DestroyImmediate(c.mesh);

 MeshCollider mc = (MeshCollider)g.AddComponent(typeof(MeshCollider));
 mc.sharedMesh = col;
 return g;

ALTHOUGH i think it welds some vertices etc... so it kinda ruined my perfectly setup collision meshes :( anyone know is this a known bug in Unity, or? Note: combining meshes and displaying them instead of using as colliders works perfectly...

Comment
Add comment · Show 3 · 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 Tzan · Jul 15, 2010 at 05:22 PM 0
Share

I reported this as a bug on 7/7/10 adding Optimize() didn't fix my example http://forum.unity3d.com/viewtopic.php?p=350153&highlight=#350153 cases: 364060 and 364291 (problems with skybox and combined mesh)

avatar image Mike 3 · Jul 21, 2010 at 08:03 AM 0
Share

Doesn't sound like a bug. The greenish collider outline is from having the collider set as convex, but convex colliders have a vertex limit of 255.

avatar image taranasus · Mar 11, 2015 at 09:53 AM 0
Share

Dear Vorda,

THAN$$anonymous$$ YOU THAN$$anonymous$$ YOU THAN$$anonymous$$ YOU THAN$$anonymous$$ YOU!

Worked like a charm :)

avatar image
0

Answer by jonas-echterhoff · Oct 01, 2010 at 09:58 AM

This is a known bug in Unity 2.6, Mesh.CombineMeshes will not generate the collision information for the combined mesh. I believe this is fixed in 3.0, though.

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

No one has followed this question yet.

Related Questions

How to remove internal triangle/faces when combining mesh 0 Answers

Rigidbody objects not colliding. 4 Answers

Pushing a mesh with mesh collider 1 Answer

Why is raycast not working with mesh collider 0 Answers

Having trouble getting a smooth collision with dynamic 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