Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Unity 2017.2 beta is now available for download.
    Dismiss Notice

Jelly Sprites - Soft body sprite physics system

Discussion in 'Assets and Asset Store' started by mrsquare, Dec 5, 2013.

  1. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    12
    Thanks! Updated to 5.5 and the problem gone
     
  2. dergachoff

    dergachoff

    Joined:
    Aug 7, 2015
    Posts:
    4
    Hi, @mrsquare!

    You've made a really great asset! But I've stumbled upon an issue. When I set JellySprite mode to Grid through inspector, I get no gizmos in the scene and the following error in the console:

    NullReferenceException: Object reference not set to an instance of an object
    JellySprite.OnDrawGizmosSelected () (at Assets/Plugins/JellySprites/Scripts/JellySprite.cs:2406)
    UnityEditor.DockArea:OnGUI()

    I'm using Unity 5.5.1.f1
    Any ideas how to fix it?

    Thanks!
     
  3. dergachoff

    dergachoff

    Joined:
    Aug 7, 2015
    Posts:
    4
    Also: any way to add a 2d joint (like a hinge joint) to the central (or any other) body?
     
  4. mrsquare

    mrsquare

    Joined:
    Oct 25, 2013
    Posts:
    239
    Hey - sorry for the slow reply. Hm, that's odd - I'm on a slightly earlier version, but not seeing that. Let me upgrade to 5.5.1.f1 and give it a try.

    Re. adding a joint to the Jelly Sprite - you'd have to do that programatically due to the reference points being created at runtime, but you'd just need a bit of code like this:

    Code (csharp):
    1.  HingeJoint2D joint = GetComponent<JellySprite>().CentralPoint.GameObject.AddComponent<HingeJoint2D>();
    Or alternatively, set up your hinge joint in the inspector and then just attach it to the central Jelly Sprite body at runtime.
     
  5. smasters654

    smasters654

    Joined:
    Dec 20, 2013
    Posts:
    28
    Hi @mrsquare

    I sent you an email about you jelly mesh asset regarding 2 materials on an mesh a bit ago but I haven't heard from you. I would have posted this in the jelly mesh forum post but it seemed pretty dead on there sorry. Please let me know how to fix this issue? Thanks!
     
  6. kapopixel

    kapopixel

    Joined:
    Apr 2, 2017
    Posts:
    29
    Hi @mrsquare

    Is it possible to clarify how to add distance joints or hinge joints etc. to add jelly sprites? It would be great. Thanks.
     
  7. mrsquare

    mrsquare

    Joined:
    Oct 25, 2013
    Posts:
    239
    Hey - sorry for the slow reply.

    So, from a script attached to the Jelly Sprite, you can access the Jelly Sprite reference points like this:

    Code (csharp):
    1. JellySprite jellySprite = GetComponent<JellySprite>().ReferencePoints[x];
    Reference points are the physics objects that control the Jelly Sprite behaviour - you'll have a different number depending on what configuration you're using. The one at index 0 is always the central reference point, and the others will be attached to that.

    The reference point itself is just a little data structure that contains a gameobject and some other info. So to add a distance joint, you just add a DistanceJoint2D component to the reference point gameobject as you would with any other gameobject:

    Code (csharp):
    1. // Get the Jelly Sprite component
    2. JellySprite jellySprite = GetComponent<JellySprite>();
    3.  
    4. // Get the reference point gameobject (pass in an index from 0 -> jellySprite.ReferencePoints.Count)
    5. GameObject jellySpriteReferencePointObject = jellySprite.ReferencePoints[0].GameObject;
    6.  
    7. // Add a new distance joint
    8. DistanceJoint2D distanceJoint = jellySpriteReferencePointObject.AddComponent<DistanceJoint2D>();
    9.  
    10. // Configure the distance joint
    11. distanceJoint.connectedBody = someOtherRigidBody;
    12. ...
    13.  
     
  8. Goodyearpimp

    Goodyearpimp

    Joined:
    Jun 5, 2014
    Posts:
    3
    I've purchased both JellyMesh & JellySprite recently (great work by the way MrSquare).


    I was hopeful that I could use this in tandem with SVG Importer from the Asset Store (Jarolic's). I am unable to use either JellyMesh or JellySprite with the Unity MeshRenders or MeshFilters generated automatically when importing SVGs through his asset. Any help???
     
  9. mrsquare

    mrsquare

    Joined:
    Oct 25, 2013
    Posts:
    239
    Hey - sorry, I'm not familiar with that asset (and sadly is a bit pricey for me to give it a test!). If you could send me an example project containing some meshes you've used it to generate, then I might be able to diagnose the issue.