I am new at this. I have tried making two horizontal gears, with one gear driving the other. I have assigned both gears a hinge joint so they will rotate. On one gear I have added a constant torque. I have also assigned a mesh collider to each The problem is that that gear teeth do not cause a collision when hit, but simply pass through each other. Also when I do not check use gravity in the rigidbody the gear does not move.
Saw this in the Mesh Collider docs. I tried checking the convex box and the gear only slightly moves, but looks like it is trying to move.
On the driving gear I added a simple scipt: Code (csharp): function Update () { transform.Rotate( Vector3.up * Time.deltaTime ); } to drive the gear instead of the hinge , constant torque and rigidbody, which I deleted. Still the same problem.
If you set the gear mesh to convex, you actually smooth out the cogs and get a wheel. http://en.wikipedia.org/wiki/Convex_set I think you should look into compound colliders i.e. recreating the shape of the gears with the basic collider shapes unity offers. There's an example on this page: http://unity3d.com/support/documentation/Components/class-BoxCollider.html
Adrian , Thanks for the reply. I really wish there was an easier way. It is alot of work to add individual box colliders to the teeth ( and a bit of a kluge). Maybe I have to look into making the gears from a script?
Travis East's GearTrain calculates the angular velocity of the final driven gear in a gear chain. The user enters the revolutions per minute and direction of the first driver gear along with information about the number of teeth of each gear in the series. The program will output the RPM and direction of the final driven gear in the gear train. The program can also calculate the linear velocity using a variety of metric and standard units. It was designed as a tool for educators and students wishing to learn or check calculations for a gear chain in a Technology Education or Robotics program. http://homepage.mac.com/teast/
Transform.Translate and Transform.Rotate ignore collisions. They just make objects move. You'll probably need to work with rigidbodies and forces instead of the Translate commands if you want the gears to interact.
Thanks. I am interested in making a mechanical gear system that uses the Unity Physics engine, not just an animation. I think maybe compound colliders are the answer on the gear teeth. Maybe there is a way to add them using scripting.
See if this is any help. Import it and run it. Making real world gears would be tricky too, but hopefully this is a start AaronC
Hi Guys I was wondering if an expert can help a rookie here. I have created a gear from Cheetah3d and imported the mesh to Unity is an obj file. I am trying to create a system in Unity where one gear will turn the other. This has proved to be much harder than I thought. I have followed many tutorials from this website + the net but I cannot get over this obstacle. Whatever I try, the gear just passes through the other gear as if it is not there. I have uploaded a scene file if anyone is generous enough to help I would greatly appreciate it.
Hi guys, I have the same trouble, physics do not work because of the needs of the kinetics or convex colliders (It is not an option for gears) so I tried with a script that calculates the output ratios as a function of number of teeth from each gear, and multiply this by the speed of the input. this for planetary gears I made. But Unity can not accurately calculate ratios like "2.3333333" An example : gear#1=14 teeth gear#2=6 teeth Ratio = 14/6 ratio=2.333333333infinitum input speed =5 RPM output speed =11.666666667 RPM But as far as continue the second gear go through the otherand its quite maddening. By the way, I'm using variables as floats, but these seem to have a limit of decimals. this is the gear set I tried then. but change the number of teeth for some more "square"... it makes no difference, in this case i used: 92 for the ring 52 for the sun and 20 for the planets so i tried and the trouble still coming this is why.... the ratio in this case is determined by the circumstances Input is the sun stationary is the carrier output is the ring so the output ratio is : -52/92 = -0,5652173913043478 and the planet ratio is -52/20 = -2,6 get an speed for the sun like 45 RPM and the speed on the ring will be -25,43478260869565 RPM and the speed for each planes will be -117 RPM Unity just cant calculate those decimals. and even imagine if the speed of the input was a float Is there any way to correct this? How to obtain more accurate calculations? have any ideas?