Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

[RELEASED] Gear Factory

Discussion in 'Assets and Asset Store' started by DennisVH, Oct 24, 2012.

  1. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Official Gear Factory support thread.

    http://u3d.as/content/atomic-crew/gear-factory/3uy

    Developer documentation, product overview can be found here: www.atomiccrew.com/gearfactory/



    A tutorial pack is available from our website. The zip on our website contains all scenes from the tutorial and the PDF file. Or you may view the PDF directly from here: Gear Factory Tutorial

    Version 1.4 (16-01-2014):
    - Changed all new properties to serialized properties (for multiobject edit, undo and prefab overrides)
    - Minor bugfix in normal calculation
    - Optimized inspector code
    - Optimized inspector presentation
    - Better calculation of batching info
    - New gear type: ring gears
    - Auto switch to ring gear when innerradius exceeds radius
    - Auto swap teeth properties when switching to ring gear
    - Option to switch off drawing outer edge in 3d
    - New option to twist the outside too

    Version 1.3 (17-06-2013):

    - Bugfix for synced speed
    - Tip angle offset
    - Valley angle offset
    - Improved new normal calculation (GenerateNormals function deprecated)
    - Split vertices based on configurable angle (great hard and soft edges)
    - UV box mapping
    - UV offset and tiling configurable in 3 dimensions
    - Fixed to keep original rotation when setting "driven by"-property
    - Interactive differential example
    - Twist option to twist a 3d gear
    - Static batching indicator in GFGearGen information block in inspector gives you an indication if the gear is below unity's vertex threshold for static batching
    - Autoset number of teeth on new gear now disabled by default (auto enabled when gear gets cloned) to improve user workflow
    - performance test example added for quick proofing if a device is capable for a user defined amount of gears (and also a great simple example of how to instantiate gears by just a few lines of code)
    - reduced overhead and cpu cycles
    - ...

    Version 1.2 (23-01-2013):

    - GFGearGen: “Align Radius With Parent” added. It will be checked by default and will appear if you uncheck the “Align Teeth With Parent”.
    - GFMachine: Documented the step method for interactive use of the machine.
    - Bugfixes and performance optimalization

    Version 1.1 released:
    - Auto align feature will auto position when radius changes.
    - Some fields converted to sliders for easy input.
    - Tutorials included.
    - Unity version 4 support! (Thanks Unity for fixing all those bugs!)

    Drive gears interactively

    For those who want to move their gears interactively, you can use the following script on your machine to control the gear-train by mouse movement as an example (make sure you set the machine speed field in the inspector to 0):

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4.  
    5. public class GFInteractiveMachine : MonoBehaviour {
    6.     private GFMachine myMachine = null;
    7.     private float speed = 40f;
    8.     // Use this for initialization
    9.     void Start () {
    10.         myMachine = GetComponent<GFMachine>();
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.         if (Input.GetMouseButton(0))
    16.         {
    17.             if (myMachine != null)
    18.             {
    19.                 myMachine.Step(Input.GetAxis("Mouse X") * speed);
    20.             }
    21.         }
    22.     }
    23. }
    24.  
    Reducing draw calls

    If you want to reduce the amount of draw calls. Make sure the number of vertices is below the threshold for dynamic batching. The threshold depends on the shader you are using. In gear factory, use the add single or add multiple in-editor buttons to instantiate the gear (which uses the same material instance). This way you can have a large amount of gears with a single draw call. You can reduce vertices by toggling 3d/2d and by reducing the amount of teeth (uncheck "align teeth with parent" to manually set the number of teeth). There is a counter in the info box in your inspector to see the real amount of vertices in the selected mesh.

    Find more about dynamic batching at http://docs.unity3d.com/Documentation/Manual/DrawCallBatching.html
     
    Last edited: Jan 16, 2014
  2. kenshin

    kenshin

    Joined:
    Apr 21, 2010
    Posts:
    919
    Really an interesting work Dennis!
     
  3. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Thanks!

    I hope people will showcase their awesome contraptions in here.
    Once you get to know all the settings, you can build fairly complex machines, build interesting puzzles or create stunning scenery.

    And if people have any feature requests, example requests, suggestions, questions, please don't hesitate to drop them in a post in here!
    :D
     
  4. mas

    mas

    Joined:
    Nov 14, 2010
    Posts:
    696
    Impressive! I really like the way that the gears fall into place and the positions and turning reflect
    reality simulation.

    The procedural generation of the gears looks wonderful too.
     
  5. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    Edit: I got it. It appears my standard version imported a pro asset per their trial, then I re-opened the project and that script error caused your assets to also bug out. Report this to Unity?

    Edit: new question: How do I link a 2nd gear? I've created them, they say they're linked, I have one moving, but adding single, randomize, and generating do not spin the gears. Only the machine one is spinning. I've guessed I need to add more machines, but then only the next one works, am I missing a step?

    - Old post for historical-
    I've downloaded onto my mac os x version of unity3d, read the readme with the assets in my project. I hit GameObject -> Create Other and nothing's there.

    also edit:
    ... unimportant stuff erased ...

    Now to try it out! False alarm, Unity bug exposed
     
    Last edited: Oct 26, 2012
  6. feiting

    feiting

    Joined:
    Oct 26, 2012
    Posts:
    33
    I've kinda debugged my 2nd question, the getter and setter on GFGear for speedMultipiler makes it not show up in the Unity3D editor, I've replaced it with a public float without a getter and setter.

    To get other gears to work, I have to manually say N children then drag them over into the right slots. They don't spin until I modify the speedMultiplier. To make it match the correct direction, I flip every odd numbered gear to negative one, everything else is one.

    The editor made this look more automated, can you provide more instructions?

    Thank you,
    S
     
  7. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    7,281
    I agree.

    I really like the tool, and it has a lot features, but some basic descriptions and instructions would be very useful. I am figuring things out, but it is by bouncing back and forth between the sample scenes and reading through the code and messing with settings. Simple instructions on your site would save a lot of time and guess work.

    That said, great plugin!
     
  8. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Thanks for the great feedback people!

    First keep in mind all examples were created with the current state of sourcecode. If you think you need to change something in the source before something basic may work, you might (there's always a possibility of a real bug) be on the wrong track.

    @feiting: make sure you place all gears as child objects of the machine that's powering them in the hierarchy, power your first gear and this will hook everything up automatically (look at the basic demo).

    There are several ways through different systems to set things up as I had creative freedom as priority one. I didn't want anyone to be pushed in a restrictive grid type method of creating stuff (look at the marble web demo on the website to see why: gears are in sync but have a visible space where the ball can move). Also I wanted to give people the freedom to choose between procedurally generated gear but also the possibility to use their own meshes created in a third party 3d modelling application.

    @feiting, @zombiegorilla: I totally agree there should be more tutorials on the website and I'm going to take care of it!
    I'll anounce them on the website and through this forum.

    NOTE: If anyone has any special requests for a tutorial, suggestions are welcome. Offcourse the basic walkthroughs will be covered anyway somewhere this week I think.
     
    Last edited: Oct 28, 2012
  9. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Tutorials are available ! More to come. See the first post anouncements for details.
     
  10. Studiomaurer

    Studiomaurer

    Joined:
    Sep 5, 2012
    Posts:
    17
    Hi,

    this looks quite nice. I was just wondering if the system also creates angular or curved gears.
    If not, would it be easy to integrate the appropriate meshes?
     
  11. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    You can place generated gears in an angle, it will reverse rotation automatically, but you can always manually override any setting within the inspector if for any reason you think it's necessary.

    You cannot generate curved gears ...yet (not that difficult and might be a nice addition)...
    You can however model such gear as a mesh and hookup the GFGear component. You just add the component and specify the number of teeth in your model. There's a tutorial package on the website that will teach you how to use non-generated gears.
    (Another option is expanding the sourcecode yourself: adding a scale factor which you send to the gfgeargen and use it when generating one of the faces is all there's to it.)
     
  12. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Oh no, I already purchased it, was hoping to create a bevelled gear.
     
    Last edited: Jun 28, 2013
  13. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Don't worry it's on the roadmap for the next release somewhere this month. The current price will be raised too! So all current customers get upgraded and new customers should hurry to get it at its current price
     
  14. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Thank you!
     
  15. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    DennisVH,

    How should I use your gear to make them rotate freely to external force? I tried to set the Machine object's speed to zero, added mesh colliders to the gears, and drop a Cube with RigidBody component in it. Unfortunately, the gears stood still.

    Any hep would be appreciated.
    -ikel $questionToAsk.png
     
  16. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    I'm really, really, really sorry for the late reply, but I didn't get a forum notification of your message (seems I can't rely on them anymore) ... :confused:

    You can use external forces on the gear using unity physics as you did, however it's the least performing option. Physics engines aren't designed to rotate gear trains when there's no dedicated solver build in, so they will fall back to regular rigid body collisions as they don't see you are using a gear train.

    The Gear Factory produces procedural gears which are regular meshes for unity. You can use them just as if they came out of your modelling application. Only difference is that the vertices are not drawn by hand, but by an algorithm. Adding physics, do something with it, doesn't matter.

    Secondly, because of the lack of fast physics solving a gear train, there's the machine, which is just an alias for gear train. The machine can be powered or non powered, but the machine overrides the rotation of the gear, because the machine is the only one who knows how to solve gears at different sizes for instance.

    So if you want one gear to react to an outside force and want it to alter the state of the gear train (machine), you must specify by code how much it should be altered as it has its own fast physics build in (which is also compatible with mobile devices). You can however use unity physx to check if the gear collides with the box and get the force vector of the box to feed the machine and the gear will turn.

    You inspired me with your differential example, so I'll do my best to get an example of both a differential and a machine reacting to outside forces to be included in the next release.

    Progress is going smooth on the next release, but with these examples it might take a few days longer than expected, so stay tuned on twitter by following @atomiccrewgames !
    :cool:
     
  17. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    A simple differential demo/example is finished.
    Script to apply force on one of both wheels to see the differential react to it is included too.

    Goto www.atomiccrew.com/gearfactory/ or just click here to start the demo.
     

    Attached Files:

    Last edited: May 29, 2013
  18. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    v1.3 available in the assetstore ! Go get it while it's hot!:cool:
     
  19. ikelaiah

    ikelaiah

    Joined:
    Apr 15, 2013
    Posts:
    154
    Thank you!
     
  20. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Sneak peek of new Gear Factory version, coming soon:

    Version 1.4 (..-08-2013):
    - Changed all new properties to serialized properties (for multiobject edit, undo and prefab overrides)
    - Minor bugfix in normal calculation
    - Optimized inspector code
    - Optimized inspector presentation
    - Better calculation of batching info
    - New gear type: ring gears
    - Auto switch to ring gear when innerradius exceeds radius
    - Auto swap teeth properties when switching to ring gear
    - Option to switch off drawing outer edge in 3d
    - New option to twist the outside too

    :cool:
     
  21. jdams

    jdams

    Joined:
    Sep 13, 2010
    Posts:
    64
    I'm currently working through some challenges in building a gear/ mechanically based game. I have a few questions for you concerning the plugin.
    1. Can I limit the rotation of a gear to specified degrees?
    2. Can I limit a gears direction of rotation (e.g. This gear cannot rotate to the left, only to the right)
    3. Does the system use rigidbody components or colliders?
    4. Are the gears generated procedurally, or via meshes?

    I would really love to purchase your plugin if it can do these things or be easily adapted to do so.

    Thanks.
     
  22. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    1. You can use the unity transform to get its rotation and easily prevent further rotation that way
    2. Like the previous answer, you can easily prevent user interaction based on a restriction. There's an example included of an music organ where the sound playback is reversed when turning the other way around.
    3. No. That would kill performance on mobile. But you can hook rigidbodies and colliders to interact with other objects (demo included where ball falls through gears)
    4. Procedurally with no performance cost over custom meshes. you can customize a lot! But you are still allowed to use or mix your custom modelled meshes too. You can for instance only use the gear physics to solve the gear train. Tutorials and examples are included for both situations too.

    If you have more questions, let me know! Cheers!:cool:
     
  23. jdams

    jdams

    Joined:
    Sep 13, 2010
    Posts:
    64
  24. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
  25. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    for those of you who haven't got it yet:

    version 1.4 is uploading to the asset store for review as we speak !
     
  26. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    And available for a reduced price of $40 ! Get it while you can!!! Gogogo ☺
     
  27. Tibor-Udvari

    Tibor-Udvari

    Joined:
    Apr 1, 2015
    Posts:
    11
    Hey, I just bought the plugin and put it in an empty 2d Unity 5 Project. It's failing to execute, can you give me some help?

    Here are the errors:
    Assets/Standard Assets/Effects/ImageEffects/Scripts/Bloom.cs(9,26): error CS0246: The type or namespace name `PostEffectsBase' could not be found. Are you missing a using directive or an assembly reference?

    Assets/Standard Assets/Effects/ImageEffects/Scripts/DepthOfField.cs(9,33): error CS0246: The type or namespace name `PostEffectsBase' could not be found. Are you missing a using directive or an assembly reference?

    Assets/Standard Assets/Effects/ImageEffects/Scripts/SunShafts.cs(9,30): error CS0246: The type or namespace name `PostEffectsBase' could not be found. Are you missing a using directive or an assembly reference?

    Update:

    Sorry I just read the instructions in the readme file, it seems to be working ok.
     
    Last edited: Jul 23, 2015
  28. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Hi thank you for purchasing and supporting Gear Factory,

    The pro examples require you to import the standard "Effects" package included with Unity.
    You can either not import the pro examples or import the effects assets by choosing from the main menu bar in unity 5: Assets>Import Package>Effects

    This should solve your problems.

    cheers!
     
  29. andrewow

    andrewow

    Joined:
    Dec 2, 2013
    Posts:
    8
    Hi Dennis, we want to create a gear puzzle for a 2D adventure game, and we are wondering if Gear Factory is a good solution. The idea is that there will be many slots where players can drag gears. The starting gear should be already rotating. If the last gear in the chain rotates in the right direction, the player completes the puzzle. The challenge is for the player to use the available gears in order to solve the puzzle (without jamming the gears). How would we use Gear Factory to do this?
     
  30. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Hi Andrew,

    Thank you for your interest in Gear Factory.
    You can create and attach gears at runtime. There are methods to align gears, finding out which direction they're turning and for positioning. The latter is important when gears have different sizes and you want the player to choose between them.
    Full source is provided.

    You can already have a look what you can use at:
    http://www.atomiccrew.com/documentation/gearfactory/

    Hope this answers your question,

    kind regards,

    Dennis
     
  31. tucano

    tucano

    Joined:
    Nov 9, 2011
    Posts:
    30
    Hi Dennis, I am a supporter of your asset and I am trying to use it in a puzzle 2D game.

    My idea is to use a Sprite with GFGear attached and the Machine but I have the following problem:

    The user should be able to:

    1. Add and Remove new gears to the scene
    2. Attach a motor belt to gears and start spinning

    I have the following questions:

    1. How can I use the Align Gear function in a 2D Scene? It is a function in GFGearGen and not a function of GFGear. My temporary solution is to make a mesh gear, disable the mesh renderer, and put the sprite as a child but is not optimal.

    2. How can I change the Machine driven gear at runtime? (the user can attach the motor belt to another gear in the Machine, in other words he will be able to change the driven gear at runtime).

    I am taking the wrong direction? Please tell me if you have a better solution for my setup.

    Please tell me if you want to see an example of what I am trying to accomplish.

    Best Regards

    Davide
     
  32. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Hi Davide,

    Thank you for your support. If you could send me a simplified example, I can try to answer your questions in that context. You can upload your files through the contact form at http://www.atomiccrew.com/support/

    Thanks!
     
  33. tucano

    tucano

    Joined:
    Nov 9, 2011
    Posts:
    30
    Ok, give me one or two days to setup a Test scene and a Test script.

    ;)
     
  34. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    How about this: I'm looking into your questions today. If the answers help you enough, it isn't necessary any longer to provide an example. This will save us both some time. :)
     
  35. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Hi Davide,

    I looked into your questions:

    The problem with this is that there are two components, first there is GFGear which does the turning and GFGearGen that handles the visual part. To align two gears, it has to know what the gear looks like to know the radius and where teeth are to match the teeth on the second gear.

    However, this should be a very generic gear oriented toolbox. So I'm still bending my mind over what and how to implement this specific situation and I'm thinking of adding some sort of custom mode to the GFGearGen to completely rule out addressing the mesh renderer, but keep using everything else, like the alignment and such. But I'm still struggling how to keep it clear where the teeth are and what the radius is and how to represent that in a generic way to the end-user.

    So to that moment it's in, you can always hack out the drawing stuff yourself in the sourcecode off course, or keep using the workaround you did. I will try to get this in for the next update somewhere this or next week.

    That functionality wasn't in fully, because nobody asked :) But I added inverse tree traversal to rebuild the hierarchy when the "powered by" changes. So in the new updated version of gear factory you can set the powered gear, by calling:

    machine.PoweredGear = newGearToPower;
    machine.RecalculateGears();


    Nope, I think you're doing well! Creative problems take creative solutions :)

    I'm still testing a bunch of other stuff coming into the new version.

    I'll keep you posted.
     
  36. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    More news about the 1.7 update!

    @tucano I thought it through and decided to do some refactoring to extract all alignment stuff into a base class which the GFGear can use too. It's much better than some headless mode hack and way cleaner! So the GFGear has an Align() method now.

    To help you setting the parameters on an invisible gear (hence nothing gets drawn, so how to determine where the teeth are and how big they should be). When there's no GFGearGen, it will draw the parameters as an overlay in the editor when the gear is selected. To give you an example what it will look like, here's a screenshot:


    The green circle is the solid part of the gear (radius minus tip length) and the teeth are represented by the green lines.

    Also what's more to come:
    - cleaned up the project
    - removed ray of gears example
    - simplified the simple example
    - replaced old particle system in organ demo
    - bugfix for missing mesh when creating prefab
    - all in unity editor generated meshes are now saved in the unity assetdatabase
    - inverse tree traversal recalculates hierarchy and allows to change powered gear at runtime
    - bugfix for error when cloning gear (int32 parse error)
    - bugfix in alignment positioning on size calculation
    - new alignment features in GFGear
    - alignment parameter helper editor indicators on GFGear

    Lots of changes and some minor issues still pending... Hope to get it submitted next week.
     
  37. RobbertUnity

    RobbertUnity

    Joined:
    Nov 9, 2016
    Posts:
    1
    Hello Dennis,

    Currently I am trying out your Add-in and I would like to know if you can help me achieve the following.
    I would like to add a script, so that the gear rotational speed of say Gear A (Driven by your Machine script) increases/decreases by 20% if hit by a collision event, this would then also affect other gears (say Gears B and C) both driven by A.

    Also is this something I would need to put in the GFGear script or could I just add an entirely new script to Gear A?
    *Also I am just getting familiar to Unity so your help would really be appreciated!


    Best Regards

    Robbert
     
  38. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    Hi Robbert,

    It can be done in several ways. But first of all, you should never add any script to the GF* classes unless you really need to "hack into the system". Because if you put code in there, and you update GF then all your changes are lost.

    You could add a new script with a collision event and put it on all gears. Or you could have an event handler on the thing that collides. Either way, just get a reference to the GFMachine component to multiply its speed with 0.2f to get it at 20%.

    And if you want to set it per gear, you have to calculate first at what speed the machine should be at when applying 20% decrease to a specific gear. After that the machine recalculates the entire chain by itself. To be able to do that you should traverse the tree yourself or wait for the new update to appear on the assetstore (expect it before the end of the month due to some delays) where there are more options build in for that.

    This might come in handy when you're just starting:
    https://unity3d.com/learn/tutorials/topics/physics/detecting-collisions-oncollisionenter
     
    Last edited: Dec 17, 2016
  39. DennisVH

    DennisVH

    Joined:
    Jul 8, 2012
    Posts:
    45
    version 1.7 is currently being tested and when all bugs are smashed (still only some minor in-editor issues at this moment) it will have the following features:

    - cleaned up the project
    - removed ray of gears example
    - simplified the simple example
    - replaced old particle system in organ demo
    - bugfix for missing mesh when creating prefab
    - all in unity editor generated meshes are now saved in the unity assetdatabase
    - inverse tree traversal recalculates hierarchy and allows to change powered gear at runtime
    - bugfix for error when cloning gear (int32 parse error)
    - bugfix in alignment positioning on size calculation
    - new alignment features in GFGear
    - alignment parameter helper editor indicators on GFGear
    - new Script Example scene that will showcase all generic script examples
    - GFGear now has currentSpeed property (in degrees per second).
    - GFGear has ratio (the traditional gear ratio: local ratio in relation to gear that powers it) property.
    - GFGear has machine ratio property (global ratio in relation to the gear that is powered by the machine).
    - GFGear inspector has information pane that shows realtime current speed, ratio's.
    - GFMachine and GFGear have SetSpeedByGear method which alters the machine speed based on a desired gear speed (see ChangePoweredGear script in the script examples scene).
    This way you can change the speed of a gear without changing the powered gear.

    and all documentation will be updated too of course ;)