Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2d Hinge Joints

Discussion in '2D' started by harveyshideout, Apr 20, 2015.

  1. harveyshideout

    harveyshideout

    Joined:
    Jan 12, 2014
    Posts:
    33
    Has anyone tried to make individual grass sprites on a hinge joint, so that when the player moves through they move and spring back???
     
  2. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    No, I have never tried to do anything like that. I would be cautious about using hinge joints for something like that. Hinge joints are physics based calculation and that is typically an intensive operation for a processor; especially in a mobile application. Depending on how many grass sprites you are using you may be able to get away with it without any serious effect on performance, but if you are planning to make a whole field or something I would personally advise against it so you can minimize your physics calculations. . In short, is it possible? Yes. Should you do it, probably not. Good luck though. If you come up with a less intensive solution I'd love to see it. You can email me at hamsterbytellc@gmail.com
    Cheers!
     
  3. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Or post it here - cause we'd all love to see it. :)
     
    hamsterbytedev likes this.
  4. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    Yeah, that's even better! :p
     
    theANMATOR2b likes this.
  5. Watapax

    Watapax

    Joined:
    Sep 3, 2013
    Posts:
    34
    Hello, i was very impressed with the animations in "Ori and the Blind Forest" and one of the details was when you walk over the grass and see how the grass moves to the left or the right depending the direction of the player. So your question motivated me to trying to achieve this effect and here is the result.

    http://www.tipografico.cl/grass/

    Move with the arrows to see the effects. I use the Puppet2D asset and check collition to trigger animations.
     
  6. hamsterbytedev

    hamsterbytedev

    Joined:
    Dec 9, 2014
    Posts:
    353
    Not bad. These are animations right, not physics calculations and hinge joints?
     
  7. Watapax

    Watapax

    Joined:
    Sep 3, 2013
    Posts:
    34
    Yes, just animations, not physics and hinge joint, but it is not efficient yet, i have 15 drawcall with 3 grass prefab.
     
  8. harveyshideout

    harveyshideout

    Joined:
    Jan 12, 2014
    Posts:
    33
    if you play limbo the grass has this effect, another wy of doing it perhpas?
     
  9. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    The webgl took forever to load, is that expected behavior?
    Is it compatible with mozilla browser? I waited and waited, then finally opened it in chrome, which loaded it quicker but still not too fast for such a basic scene.

    Nice effect - if drawcalls can be reduced considerably.