Search Unity

Moving Gears

Discussion in 'Editor & General Support' started by ctsteve123, Jul 12, 2008.

  1. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    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.
     

    Attached Files:

  2. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    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.
     
  3. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    On the driving gear I added a simple scipt:

    Code (csharp):
    1. function Update () {
    2.    
    3.     transform.Rotate( Vector3.up * Time.deltaTime );
    4. }
    to drive the gear instead of the hinge , constant torque and rigidbody, which I deleted.

    Still the same problem.
     
  4. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,065
  5. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    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?
     
  6. olin

    olin

    Joined:
    May 23, 2008
    Posts:
    5
    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/
     
  7. GargerathSunman

    GargerathSunman

    Joined:
    May 1, 2008
    Posts:
    1,571
    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.
     
  8. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    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.
     
  9. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,552
    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
     

    Attached Files:

  10. ctsteve123

    ctsteve123

    Joined:
    Sep 13, 2007
    Posts:
    51
    Targos - Wow! Thanks alot. This is excellent!
     
  11. ml1985

    ml1985

    Joined:
    Dec 29, 2013
    Posts:
    22
    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.
     

    Attached Files:

  12. akamaru

    akamaru

    Joined:
    Mar 19, 2014
    Posts:
    1
    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 other:mad::mad::mad::mad:and 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.
    Sin título.png
    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:mad:
    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.:confused::confused::confused::confused:

    and even imagine if the speed of the input was a floato_Oo_Oo_Oo_O

    Is there any way to correct this?
    How to obtain more accurate calculations?
    have any ideas?