collision detection in my limited and rapidly fading experience of some vague readings a long time ago is that it is computationally expensive and probably in the case of something like meshing gears prohibitively so unless you have access to some kind of super-computer. That's why in 3d games (e.g.) you can not move through a wall, but you can stick your arm through it (and annoyingly, get protruding body parts shot or even stuck). You're probably better off manually timing out the gear meshings by trial and error/maths.