Search Unity

How do i make a string of objects stay upright under gravity

Discussion in '2D' started by Shamini, Apr 25, 2019.

  1. Shamini

    Shamini

    Joined:
    May 9, 2014
    Posts:
    13
    Hey,

    I started working on an idea of mine recently which consists of a ball with chains on it like grass. I have attached a picture showing the concept of the same. I wish to know how I can keep the chains upright like they have a springy effect on them. In my current prototype, each link of the chain is connected to another link via a hinge joint. But when I add gravity, the chains all fall down on each other and they look like limp noodles.

    I want them to stay upright while allowing interactions with other objects via physics like wind, water and a rake maybe. I tried using anti gravity but it caused the joints to break when interacted with in any form. Can someone let me know how to proceed in order to achieve something similar to the attached picture?

    Any help is appreciated. Thanks for reading.
    ~~~~
    This is what I wish to achieve.
    Fernhair.jpg

    ~~~
    This is what I have achieved so far
    greenhairchain.PNG
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    The physical constraint you're describing is stiffness. In Unity, the Spring Joint 3D has a spring parameter, but the Spring Joint 2D influences the stiffness with a frequency parameter. The 3D Hinge Joint includes some Spring capabilities.
     
  3. Shamini

    Shamini

    Joined:
    May 9, 2014
    Posts:
    13
    Hello halley. Thank you for your response. Sadly even with maximum frequency, the grass still gives into gravity and falls down like the chains. Is there any other way to keep them upright but bent slightly like weeds?
     
  4. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,779
    Try reduce gravity force, or mass of chained links.
     
  5. Shamini

    Shamini

    Joined:
    May 9, 2014
    Posts:
    13
    Thanks for the response Anty. Just attempted your suggestion. The problem with reducing gravity/mass is that it produces the same result, just slower. They still fall down slower, instead of staying up due to like tensile strength or something similar.
     
  6. RockyWallbanger

    RockyWallbanger

    Joined:
    Mar 16, 2014
    Posts:
    85
    You can put angle limits on each HingeJoint2D