Search Unity

SoftBody/JellyPhysics in Unity

Discussion in 'Scripting' started by jstriedinger, Jan 27, 2013.

  1. jstriedinger

    jstriedinger

    Joined:
    Apr 19, 2011
    Posts:
    58
    HI everyone.

    So, a friend and I are developing a 2D game and, right know, we are dealing with making a softbody structure in Unity, and we've tried a lot of things.

    We tried to get inside the code of Farseer and create a Softbody structure but, well we just couldn't so, at this moment, we are looking for people who have done something similat to what we are aiming. I mean, I'm pretty sure we are not the first one trying to create 2D softbodies!

    So. We found out about JellyPhysics by the great Wallaber which is a library for softbody in XNA and I was wondering if anybody has used it? Has anybody made a port to Unity? or tried it in someway?

    Thanks a lot!
     
  2. xikky

    xikky

    Joined:
    Dec 11, 2012
    Posts:
    47
    I need this one too. Would really appreciate some help on this :)
     
  3. nullstar

    nullstar

    Joined:
    Jul 2, 2010
    Posts:
    186
    I had a good crack at creating a softbody add-on for Unity once, you can see it in action here:



    It was based on lattice shape matching with some custom speed improvements I developed. You could try researching that for a starting point, although I'm not sure how well it would translate into 2D. The problem with doing these kind of things I've found is that Unity is very very limited when it comes to supporting custom physics solutions. In order to get what you see in the video working it was necessary to jump through so many hoops and write so much custom collision code that it was difficult to integrate into the editor and turned out not to be very viable.

    Simpler alternatives you could perhaps consider though include an inflated cloth solution using Unity's built in cloth physics, or creating a system of rigidbodies and spring constraints which form the hidden bone structure of your object and which are then used to skin your mesh.
     
  4. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    I ported walabers engine. Its decent enough, though there was no support for dynamic rigid bodies and the collision detection had some errors. I needed dynamic rigid bodies so I had to add support for that and had to change how the collision resolution worked, changed the integrator, implemented shock propagation, etc.

    http://forum.unity3d.com/threads/169932-Soft-and-Rigid-Body-Physics-Engine

    Those are some of the examples of it in action.

    Maybe once I finish my game, ill consider making the port available, its a bit too messy and lacking to give out just yet.

    Porting walabers engine as is isnt too bad though, just drag into unity and look at the errors in the console one at a time.