- Home /
physics and colliders for a couple of gears
Hi, let's say I have to create a mechanism with a couple of gears that have to play exactly like in the real world. So, I import and place two meshes of a gear with 32 teeth. Then I create an empty game object and add a box collider and a rigidbody, and then size the collider to be right for a single tooth of my master gear. Then I make the empty gameobject child of my master gear. After that, I duplicate that block and repeat the process for all the teeth of my master gear (a long job of positioning and rotating...). Obviously, then I move to the slave gear and do exactly the same. The master and the slave gears are then positioned with two hinges, each one with a rigidbody. But when I make the master gear rotate (using a rotate action of PlayMaker), its rotating crown and teeth simply pass through the ones of the slave gear. And nothing else happens. What am I missing? I'm not putting myself in writing miles of code, and I'd rather stay on use of Playmaker for all that can be done with it, also in this case if possible. Any idea? Any help? Thank you
Answer by Adamcbrz · Apr 08, 2012 at 01:22 AM
You might want to add a rigidbody to one or both gears. You probably don't want gravity and make sure to constrain position of the rigidbody and only allow rotation along the access of the gear that needs to rotate. I think that will take care of it.
A rigidbody has been already added to the gears (both master and slave) and rotation has been contstrained yet, but it doesn't help at all... the master gear still rotates passing through the slave one, and the slave one remains motionless. Any other idea?
probably obvious, but make sure "isTrigger" is not checked..
Answer by AriLarikins · Apr 24, 2012 at 08:55 PM
Hi...
I've been playing about with something very similar and had the same problem.
As Adamcbrz said, constrain everything apart from the z rotation in the parameters.
After a spot of Googling, I found that you need to add a mesh collider - not box - and set it to Convex in the parameters. Mesh colliders won't collide with each other unless you do.
http://unity3d.com/support/documentation/Components/class-MeshCollider.html
I did get it to work though, albeit a bit twitchy.
Answer by ConfucianFighter · Mar 16, 2014 at 03:47 PM
Making the mesh convex solved the problem for me. Thanks guys!
Your answer
Follow this Question
Related Questions
Ignore sub-colliders for center of mass in Rigidbody2d? 1 Answer
Physics question 1 Answer
Camera gets flung off of the map when the player collides with certain objects. 0 Answers
Physics Possibilities?: Angles, Penetration, Exceptions 4 Answers
ball's collider sometimes catches an edge and bounces. when ball rolls over two aligned platforms 1 Answer