Search Unity

Jello Physics: soft body physics [FREE]

Discussion in 'Assets and Asset Store' started by mu-kow, Jan 31, 2014.

  1. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Jello Physics is now available on the github for FREE.

    Turn any PolygonCollider2D into a fun and dynamic JelloBody!

    Jello Physics allows you to create configure and manipulate soft bodies that work with Unity's 2D physics engine.

    Web Demos

    Sticky Web Demo.

    $sticky.gif

    Spiffy Web Demo.

    $spiffy.gif

    Features:

    -Base, Spring, and Pressure bodies.
    -Auto-generate Internal and edge springs.
    -Add individual springs for custom control.
    -Control over near every aspect of every body and the simulation.
    -Link your body to a mesh for dynamic mesh deformation.
    -Internal points for stability and improved mesh deformation.
    -Collide against BoxCollide2D, CircleCollider2D, and PolygonCollider2D.
    -Custom Collision Events for even more fine tune control.
    -Attach Points to pin objects to, for more appealing deformations.
    -Joints to attach objects together mechanically or fix your soft body to a point in space.
    -Sprite and texture deformation supported.
    -RageSpline support.
    -2D toolkit support.

    Visit the Docs

    Note:

    -Not performant enough to allow for large numbers of bodies to collide all at once.
    -A JelloBody will not collide against a EdgeCollider2D.
    -Ragespline beak and emboss not currently supported.
    -2D toolkit splice and multi-atlas not currently supported.
     
    Last edited: Oct 28, 2014
    jeffreyschoch likes this.
  2. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    It is looking nice.

    I send you a PM
     
  3. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Thanks!

    I replied!
     
  4. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    Just bought it and will play with it the next days :)
    Send you an email.
     
    Last edited: Feb 2, 2014
  5. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Thank you for your support! Replied!

    Version 1.02 has been submitted and is pending review.

    1.02 fixes the erratic behavior when selecting a body in the editor while in play mode.
     
  6. jeffweber

    jeffweber

    Joined:
    Dec 17, 2009
    Posts:
    540
    Congrats on his tool. Looks very cool. Hopefully I can find a reason to use it in a future game.
     
  7. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Thanks Jeff! I hope you can too!

    On another note, 1.02 is live on the Asset Store!

    1.02 addresses a bug that causes bodies to behave erratically when being selected in the editor while in play mode.

    And as for the next update,

    "Attach Points" will be be added, though i do not know if that will be the word that I use. They will function to allow you to pin a transform to a certain point of the soft body and will keep its relative position to the body with deformation.

    If anyone has any feature-request/bug-reports/general feedback feel free to email me at cto@mukow.com or just leave a comment on this thread!
     
  8. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    JelloPhysics 1.03 has been submitted to the Asset Store.

    New features / changes include:

    "Attach Points" - pin a transform to a point on the body.
    Impulse Based Collision Resolution - Greatly improves stability and predictability of collisions.
    Removal of Spring Based Collisions and relevant settings - see above.

    The impulse based collisions are really a vast improvement over the spring based collisions so spring based collisions have been removed entirely.

    If you have already purchased JelloPhysics and do now wish to wait for the asset store, send me an email at cto@mukow.com with your invoice number and i will give you access to the most recent build.
     
  9. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    JelloPhysics 1.03 is live! Get it now in the Asset Store.
     
  10. jon_reid

    jon_reid

    Joined:
    Nov 29, 2013
    Posts:
    12
    This looks great! I've been after some soft body physics for Unity for some time now.

    Whats the performance like on mobile? Whats the cost per soft body rendered on screen? Could you have a lot of them together at once?
     
  11. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Thanks! I hope this package will suit your needs.

    Performance is limited (on any platform) by collisions. The greater the number of points per body per collision, the greater the hit. This can be worked around a bit by breaking some colliders up into smaller segments, though that isn't quite possible for the soft bodies themselves.

    Rendering is the same as any other mesh so the cost of rendering is a non-issue. The point positions are integrated each fixed update and the mesh is updated once per update. This has so far been a non-issue in my own testing as well.

    In short, you can run JelloPhysics on mobile, I only ever tried a .apk on my Galaxy Note II, but you will be limited to only a few soft body collisions at a time.

    I hope this answers your questions.
     
  12. sloopidoopi

    sloopidoopi

    Joined:
    Jan 2, 2010
    Posts:
    242
    Hi,
    any plans to extend this to 3D?
     
  13. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Sorry, but no.

    I think focusing on this asset in 2D is much more important to me and my customers at this point.
     
  14. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    There is currently a bug with colliding against Kinematic JelloBodies. You may see tunneling and erratic behavior/explosions.

    This can be seen in the currently provided demo scene. I am working to fix this asap. I am sorry that this was not caught sooner.

    On a brighter note, the update pending review comes with a new demo scene and performance increases!
     
  15. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    JelloPhysics 1.1 is now available!

    1.1 introduces:

    Overall performance increases.
    Collision Events.
    Spiffy new demo scene.

    check out the new demo scene here.

    1.11 has also been submitted, addressing some collision response errors. If you need the fix sooner, email me cto@mukow.com with your invoice number and i will be happy to provide it to you sooner.
     
  16. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    JelloPhysics 1.11 is now available!

    changes:

    Optional mesh normal and tangent calculations (uncheck to save ram). - this option is available in the mesh link component.
    Collision Response Bug Fixes.


    Another bug was found with CircleCollider2d collisions and has been fixed in the most recent submission (1.12) to the asset store. Email me at cto@mukow.com with your invoice number to gain ftp access for earlier access.
     
  17. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    JelloPhyiscs 1.2b1 has been uploaded to my server!

    If you have purchased JelloPhysics and want access to beta releases and asset store releases still under review send me an email at cto@mukow.com with your invoice number.

    1.2b1 includes joints, demo scene demonstrating joints, editor rework and many bug-fixes.
     
  18. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    The newest demo scene to be included with JelloPhysics can be tried out here:

    Sticky Web Demo

    also added link to main post
     
  19. DannyWoo

    DannyWoo

    Joined:
    Oct 25, 2012
    Posts:
    12
    Hello
    it is great asset but
    there is some error connect with tk2d asset.
    when i click tk2dmesh link apply button, i got this message

    Can't add component because class 'tk2dMeshLink' doesn't exist!
    UnityEngine.GameObject:AddComponent(String)
    JelloBodyEditor:ChangeMeshLink(JelloBody) (at Assets/JelloPhysics/Editor/JelloBodyEditor.cs:925)

    plz let me know what is wrong
     
  20. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    To prevent compile errors from showing up when you import the Jello Physics into your project, the 2d toolkit and Ragespline mesh links are kept inside of a zip file named MeshLink.zip

    extract that archive.

    move the editor classes into any folder named editor (this wont be required in future updates, as they will be stored in the zip with the correct folder structure)

    You should be good to go!

    You can simply delete the ragesplinemeshlink class if your do not have ragespline in your project.

    Hope this helps!
     
  21. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Jello Physics 1.2 is now available on theAssetStore.

    Whats new in 1.2?

    Jello Joints added.
    Jello Attach Points modified to allow for pegging to 1-3 point masses.
    Editor overhaul.
    Meshlinks support scale, offset, and rotation.
    Meshlinks auto-select materials.
    Ragespline meshlink updated to work with the newest RageSpline update.
    Sprite Mesh Link now supports sliced sprites.
    New Demo Scene added.
    Editor will now warn you if trying to add a meshlink that doesn't exist.
    Better Code Commenting.
    Performance increases: component cacheing.
    Shape matching simulates more accurately.

    Notable bugfixes:

    Fixed occasional division by zero in pressure body force accumulation (caused NAN errors).
    Kinematic rigidbodies will no longer accept velocity changes from collisions with soft bodies.


    With this new build, you will need to rebuild any existing attach points.
    You will also need to refresh any mesh links. Sorry for any inconvenience that this may cause.
     
  22. DannyWoo

    DannyWoo

    Joined:
    Oct 25, 2012
    Posts:
    12
    i want to know how can i make a JelloBody platform like a diving board.
    platform fixed to cliff and interactive with jelloPlayer.
    Thanks
     
  23. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Create a long spring body with a decent number of points along the longer side. Either use shape matching or internal springs (internal springs would probably work better for this). you could even use both, but i would use lower stiffness and damping values for shape matching.

    set the mass of point masses that you want to be immobile to 10,000 or greater (will flag as static)

    x---o---o---o---o---o---o---o
    |.................................|
    x---o---o---o---o---o---o---o

    The above diagram shows Xs and Os as point masses. the Os have normal mass and the Xs have infinite mass.
    ignore the ............... in the middle that was just toe make the | line up correctly with the o

    If you have any issues with your body going through it, try reducing fixed time in the physics settings or playing around with penetration threshold ind the jello world settings or make the diving board thicker.

    Hope this helps!
     
    Last edited: May 7, 2014
  24. maltadirk

    maltadirk

    Joined:
    Mar 12, 2014
    Posts:
    43
    Hey mu-kow,
    very nice tool!
    I'm still contemplating of whether to go with Jelly Physics or Jelly Sprite will be better. Can you please specify where your tool is better.
    Will something like the following work well on mobile (iphone 4 and up): http://www.mukow.com/Unlisted/WebDemo/WebDemo.html.

    Also I'm working on a 2d platform. Will Jelly Physics works well on mobile for character physics like in Leo's Fortune:
    http://youtu.be/aeWaoNRUfxo?t=1m58s

    P.S. any progress on getting Jelly Physics to work with Edge Colliders?

    Keep up the good work ;)
     
  25. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106

    Maltadirk,

    Thanks!

    Which tool is better is really dependent on which tool is better for you, so without knowing more requirements than Leo's Fortune (which both systems would likely be able to manage without issue) i cannot tell you that one is better than the other.

    I can list a few features/differences between the tools (MrSquare feel free to chime in if anything is inaccurate)

    Jelly Sprites is as MrSquare himself pointed out probably a bit easier to set up.
    Jello Physics isn't really difficult to set up, but understanding what everything is and how to make best use of it may be difficult for some.

    Mr Square also said:

    "Jelly Sprites has the advantage of being totally Unity based, with no custom physics - so while its simpler, it'll also be much easier to integrate into an existing project."

    But I don't really think that there are any big hurdles to integrating into existing projects. Not colliding with edge colliders is really the only thing that would require you to chance how your project is setup in order to work with jello physics. It is really as easy as attaching a jello spring body component to a game object and pressing play.


    Jello Physics wont have as much of an issue with points of two soft bodies penetrating into each other and staying there. This is actually the reason i worked so hard on Jello Physics. I originally made a system very similar to Jelly Sprites over a year ago and was not personally satisfied with the circle colliders being able to push into each other. Or if point of a collider is poking into the gap between a to circle colliders, the mesh does not deform because there is no collider there to push back against.

    Jello Physics handles rotation perfectly as opposed to Jelly Sprites: "You can rotate a Jelly Sprite, no problem - from my experience, its pretty hard to make them rotate naturally though."

    Jello Physics has a Shape Matching system that applies forces to its points to attempt to bring vertices back into shape (for more complicated shapes, it's more reliable than just distance based springs connecting points together).

    Jello Physics has pressure forces that can be used to inflate/deflate bodies.

    Jello Physics supports rage spline.

    Jello Physics can only be used within Unity's 2d physics system where as Jelly Sprites can work in 2D and 3D.

    Overall i think Jello Physics is more powerful with what can be accomplished, but may a steeper learning curve.

    So, the web demo works just fine on my Galaxy Note II, but have not tested it on an ios device yet.
    Don't however demand large numbers of soft bodies, or large numbers of vertices in the soft bodies or what they are colliding against.
    The same performance limitations likely apply between Jello Physics and Jelly Sprites. I have done no comparison between the two, so i could not say which one is more performant.

    Jello Physics is a bit more expensive than Jelly Sprites.

    Leo's fortune would be no problem at all.

    I have not been working edge-colliders, I am waiting for Unity to update the 2D physics engine (supposed to be in 4.5) before working on that (as it may include big changes that make it possible). edge-colliders may never be supported.

    I hope that is helpful and fair.

    Feel free to reply/message/email with any other inquiries!
     
    Last edited: May 9, 2014
  26. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
  27. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Jello Physics 1.23 is now live in the asset store.

    Take a look at this blog post for what's new.
     
  28. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,257
    This is great.
    Thank you for the great support and making this better :)
     
  29. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    And Thank you for your support of Jello Physics!
     
  30. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    pietroune likes this.
  31. pietroune

    pietroune

    Joined:
    Feb 26, 2014
    Posts:
    3
    David, thank you for the great effort. Great improvement compared to the old API!
     
    mu-kow likes this.
  32. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Jello Physics 1.24 has been released to the asset store, see this blog post.
     
    Last edited: Sep 12, 2014
  33. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    have any demos with multiple jello physics body parts for a single character?
    can i do this with this
     
  34. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    @biasless i do not have any demos like that, though maybe i should make one. I really need to make more demos, I'm just terrible at putting art together.

    You can do that with this though.

    You could link multiple bodies together via the JelloJoint sub component. In this case, two points on each body would be jointed together and each body would apply/receive forces based on the joint(s).

    You could also use the JelloAttachPoint sub component. In this case, the attach point will be pegged to a point on a JelloBody and the attached transform will have it's position moved to the attach point position each fixed update. (This is how the eyes work in the spiffy demo). The attached jellobody would need to have shape matching enabled and be set to kinematic. You would also most likely want to place them on separate collision layers, or use physics2d.ignorecollision to make sure they cannot collide with each other.

    I hope this helps!
     
  35. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    Yes Cheers,
    Thanks for reminding me about collision layers!
     
  36. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    unzipped the rageSpline files,

    jello mesh keeps turning off auto-refresh which i need for my animations

    is there away around this?

    also polygon colliders are functioning odd, if I drop a triangle on another triangle
    it sits on top as if it was a square
     
    Last edited: Sep 18, 2014
  37. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    I'm not sure exactly how your animating your body, so i can't give you a perfect answer, but, you could go to the RageSplineMeshLink.Initialize() method and comment out the line that sets auto-refresh off. It would definitely break things if you are using internal point masses. It might break things even if you aren't. So there may not be a way to cleanly work around it.

    That seems a bit odd. By any chance in the RigidBody2D component do you have Fixed Angle box checked?


    Edit: make sure you are using the latest version of RageSpline please!
     
  38. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    yea not a good idea to mess with the mesh :(

    it would sort of slowly float down sometimes,,
    I think I just need to get my head around these different spring settings

    how can I set this up so this object can just sit there with out moving all over the show
    3.png
    uses a joint for each foot that is attached to a empty gameObject parented to the middle shape

    after I set the solidity it changes back to 0% when I hit play
     
    Last edited: Sep 18, 2014
  39. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Let me put together a demo scene with a few different configurations.

    For the solidity, it is meant to be used to change the solidity up or down by a percentage when your press the plus or minus.

    http://mukow.com/jello_physics/manual/manual_jello_body_solidity.php

    Its a rough way to increase all spring values up and down, quickly.
     
  40. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    Thanks thats what I've been looking for, but clicking plus and minus nothing happens
     
  41. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    It may look that way, but if you select the springs subcomponent editor and foldout shape matching, and then try it, you will see the shape matching stiffness and damping change by the percentage that you entered.

    It changes the values of shape matching springs, edge springs, internal springs, custom springs and gas amount.
     
  42. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    yes i did make sure,
    tried rebuilding internal springs because I removed some, still same
    tried on newly made jello rage blob to make sure
     
  43. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Solidity works just fine on my end. Im using unity 4.3.4 on windows 8 and I'm using the latest jello physics and latest ragespline.

    I looked a bit at jellojoints, (im a bit busy with other things at the moment) and it looks like they do not work when both bodies are in different levels of the hierarchy. I may be able to fix this or i may not.

    I'll let you know what i come up with.

    -David-
     
  44. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    so might be cause I'm on 4.5.3f3 ?

    Thanks you for your help Cheers, nick
     
  45. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    Now that i've had a chance to test it on 4.5.4f3 on a macbook pro, I can say that i am still having no issue with solidity. I can only list the exact steps i used to make it work.

    1. Select a JelloSpringBody or JelloPressureBody (JelloBody has no spring values so there is nothing to be modified by solidity)
    2. Enter 10 in the solidity field
    3. Select the Springs subcomponent inside the JelloBody editor.
    4. Expand the Edge Springs foldout.
    5. Expand the Spring # 0 foldout.
    6. Press the + next to the Solidity Field.
    7. Observe that Spring #0 Stiffness is now ten percent greater than it was and Spring # 0 damping now one percent greater than it was.

    If you still cannot get it to work, then maybe you can send me a sample project so i can track down the issue causing the failure?
     
  46. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    hey my bad :), didn't realize the plus adds the user defined percentage

    in the jelloWorld collision settings, any way to fully avoid object clipping ( both set to 1)
     
  47. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    By clipping you mean penetrating deep into and then no longer counting the collision (passes right through)?

    You need to set both Penetrartion threshholds according to the size of your game objects.

    For example, if you are using Ragespline prefabs for the scale of your world, you might be better off with a penetration threshhold of 2 or more. The tangent threshhold affect more of how friction feels. But you would also want to upscale this from the default for large scale worlds.

    By the way, I'm still putting the joints scene together for you (Been busy over here).
     
  48. mu-kow

    mu-kow

    Joined:
    May 15, 2012
    Posts:
    106
    @biasless create an account at www.mukow.com and you can access the demo scene i made for jointed and attach point bodies via the downloads section.
     
  49. AVOlight

    AVOlight

    Joined:
    Apr 15, 2014
    Posts:
    401
    Thank you, looks interesting
     
  50. Gunhi

    Gunhi

    Joined:
    Apr 18, 2012
    Posts:
    294
    ===== RageSpline MeshLink ===
    To set-up:
    1. In the RageSpline component, set Physics: to Polygon. <- I can see this enum in RageSpline's physic component
    ===
    So it result error:
    "The selected MeshLink type does not exist."
    Please help