- Home /
Issue regarding combination of objects
Hello Everyone,
Thanks for helping me out with my previously asked questions.
I think I ran into another issue, which is strange but common to people who are working on 3D. I have two different shapes (Objects), they are not sphere, circle, cube etc. They are two polygons basically with one of them having a circular pipe coming out from one end, which can be inserted into the second shape (object).
So, what I am trying to do is, I have added a Mesh collider on both of the polygons (objects), I am trying to move one object (one with circular pipe at one end), I am trying to move this with mouse and trying to insert it into the second object, but it passes through the second object, it doesn't collide, actually on collision I am combining the two and making the first one as a parent of the other. I tried adding different colliders like Sphere, Box, but when I make my polygon as Box then it treats the whole object as Box and when I move this one then it never goes into the hole of second object, it tries to collide on the boundary of the second object.
Please help.
Thanks, Lokesh Sehgal
Cut out the parenting/childing for now, ensure you have colliders/rigidbodies etc. Check objects against others objects (boxes etc). I wouldn't $$anonymous$$d testing it myself, if you could throw your mesh files somewhere for me to download :)
Answer by CostelloNicho · Aug 20, 2012 at 04:54 PM
Lokesh,
Static colliders will not collide with other static colliders( colliders without rigidbodies.) Add a rigidbody to one or both of them for the desired effect. For more information read up here: Unity Physics There is a good Table of all the working collisions. Also Mesh colliders work more consistently against primitive colliders (cube / sphere etc.) So you may want to use primitives on one of your objects.
Good points - I'm guessing though given the example offered that it's the back face culling that is causing there to be no collision. Or they aren't convex. Or probably both!
It is my belief that back-face culling only acts upon the rendering of objects and not their physical attributes (colliders being a physical component). I have not played with Unity's culling system yet so this is just speculation but if what your saying is true then objects that are not visible to the player would fall through the ground.
Check the documention on mesh collider collisions and you will find that they are also culled.
Thanks Everyone for writing back. I have already applied a rigidbody component on both the polygons. The issue that I am facing is, If I enable "Convex" then the object (Eg. ObjectA) which I am trying to fit into another object (Eg. ObjectB), doesn't fit properly as my objectA has a circular shape from one end, which can only enter into ObjectB from one end. But the problem is, ObjectA not only have cirucular shape from one end, but this circular shape does have many small circular shapes within the big one, which can only fit into ObjectB from one end.
Real life example could be similar to this Lego, Like how do you join the headlight/yellow lights in the car - http://www.wired.com/images_blogs/gadgetlab/lego-beetle.jpg
If I apply the convex + Rigidbody + mesh then it it applied on the complete Object (ObjectA) and it doesn't fit into the ObjectB, it can only fit if I use it normally, but this cannot happen without using the collider.
Thanks for the help guys, you guys are great. :)
Answer by whydoidoit · Aug 20, 2012 at 04:24 PM
MeshColliders are subject to back face culling and must be marked as (and be) convex to enable collisions in any case. That's probably your problem.
You are probably better off forgetting the mesh collider and trying to create a series of child primitive colliders that represent the shapes of the objects in a more basic fashion.