Search Unity

Assets Obi Particle Based Physics (Cloth, Rope, Fluid) thread

Discussion in 'Works In Progress' started by arkano22, Jun 30, 2015.

?

Performance vs compatibility

Poll closed Oct 9, 2015.
  1. I don't care about performance, keep my data intact please.

    0 vote(s)
    0.0%
  2. I don't care if I have to re-do some stuff, as long as it runs faster.

    14 vote(s)
    100.0%
  1. Deckard_89

    Deckard_89

    Joined:
    Feb 4, 2016
    Posts:
    188
    I actually prefer written tutorials myself, as they're easier to follow, and easier to update. I'm always in the minority whenever I say this though, lol.
     
    VictoryWorks likes this.
  2. fek

    fek

    Joined:
    Sep 14, 2015
    Posts:
    13
    Wooo, Fluids 3.0! <3

    Working on getting it set up, and I'm running into an issue where the fluid renderer seems to be ignoring depth testing. Fluids always render on top of everything else, even if they're behind other objects. I noticed that depth testing works correctly in the preview videos, so I assume I'm missing something. Any ideas what I might be messing up?

    Thanks!
     
  3. unikum

    unikum

    Joined:
    Oct 14, 2009
    Posts:
    46
    Are there any examples how to directly manipulate particles in a cloth, if that is possible? For example dragging a particle by click drag on it.

    My actual use case would be to move particles in the cloth that is colliding with an object, to make sure they don't pass through. Any help on how to do this?
     
  4. sunyifeng

    sunyifeng

    Joined:
    Nov 4, 2014
    Posts:
    28
    Hi,

    I want to know the Obi Cloth 3.x ps4 supporting progress, I want to use Obi Cloth in our ps4 projects? Maybe give me some date when is the ps4 supporting coming?

    Thanks!
     
  5. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Take a look at ObiClothPicker.cs, it allows you to pick and drag cloth particles with the mouse.

    Anyway cloth particles that collide with an object should not pass trough under pretty much any circumstance, since Obi uses continuous collision detection by default. Could you explain what you're trying to do a bit more in depth?
     
  6. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Unity 5.5 implements reverse z-buffer in windows, which is something I wasn´t aware of until recently. So it expects the depth values written by the fluid renderer to be in the near=1, far = 0 range, instead of near=0 far=1 range which is what it currently outputs. (Also, this change breaks pretty much all existing depth-based shaders, so imho Unity should have given a bit more publicity to this :confused:)

    We have fixed this and are waiting for validation on an update, in the meantime replace Obi/Resources/ObiMaterials/DielectricFluidShader.shader and ObiParticles.cginc with the ones I´m attaching. (IMPORTANT: rename ObiParticles.shader to ObiParticles.cginc, as the forum didn´t allow me to upload a file with the .cginc extension for some reason)
     

    Attached Files:

  7. unikum

    unikum

    Joined:
    Oct 14, 2009
    Posts:
    46
    Thanks, I'll check out the script, didn't know about it!

    I'm looking at using Obi cloth as a net that will catch balls shot at it in higher velocity. If you take the CollisionCallback demo for example, and add velocity to the capsule so it doesn't just fall down with gravity, but has force applied to it, it will pass through the cloth. You need really dense cloth particles to make sure a hole isn't created for the object to pass through (I guess this is the problem) and having too many particles makes performance heavy. So I'm looking for ways to solve this issue. One can look at it as a soccer goal net that tries to keep a hard shot from passing through the net/cloth, to make the example more easy to understand.
     
  8. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    You know, Obi was actually born to solve this exact use case, back in 1.0 :). You can increase the size of particles in your cloth, increase their mass (at high enough masses they will stop pretty much anything), and/or reduce the mass of your ball. Also increasing the amount of distance constraint iterations in your solver will help.

    If the object goes trough your net, it will be because it is too heavy and particles are just pushed apart, opening "gaps" in the mesh trough which the ball slips trough. A lighter ball, or heavier particles, will make it harder for the ball to push them apart. Playing with the mass ratio between particles/ball and giving distance constraints a slight "oomph" will probably fix you issue.

    cheers,
     
  9. unikum

    unikum

    Joined:
    Oct 14, 2009
    Posts:
    46
    Thanks, I've been playing around with the values and I think I might be able to get something out of it eventually. There seem to be an issue where the ball can get stuck between particles if they are big and overlapping. I will keep at it trying to find a sweet spot. Thanks for the help, really appreciate it!
     
  10. rectalogic

    rectalogic

    Joined:
    Nov 30, 2012
    Posts:
    34
  11. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
  12. OnlyVR

    OnlyVR

    Joined:
    Oct 5, 2015
    Posts:
    52
  13. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    396
    Do you have a time estimate on Obi Rope v3? :)
     
  14. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Yes, I´m just finishing it and should be 100% complete at the end of this week. Unless anything weird shows up in the final tests, should be uploaded to the store next week, and from there we are on the reviewer's hands.
     
    iddqd and Too-Nerd-To-Die like this.
  15. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    396
    Great news!
     
  16. OnlyVR

    OnlyVR

    Joined:
    Oct 5, 2015
    Posts:
    52
    Version: 3.0.2 (Apr 03, 2017) ObiClothPicker.cs stopped working, collider.Raycast is always false.
     
  17. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Yes, I´m aware of this. Totally looks like a bug in Unity, since nothing has changed from our side of things. In 5.5 you can change the mesh collider geometry and perform a raycast in the same frame, in 5.6 this no longer seems to work.

    I´m investigating the issue further, to consider sending a bug report. When looking at the 5.6 changelog, I see tons of collider-related changes, but nothing specific of MeshColliders.

    Edit: Seems per-collider raycast queries no longer work if the collider is disabled (it did in 5.5, which makes perfect sense as you're actively raycasting a specific collider and not the whole scene, it should work regardless of its activation state as you can always check for activation yourself -and not perform the raycast if inactive-. Forcing it to be always active means other colliders will collide with it, which is something you don't want.) This might be the cause of the bug, still looking into it.
     
    Last edited: Apr 6, 2017
  18. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Yes, the issue is that per-collider raycast queries no longer work on inactive objects. This is quite unintuitive behavior imho, makes sense for scene-wise ray casts but not for individual colliders. Not entirely sure if it's an actual bug or a deliberate (and undocumented) design choice, but the fix on our part is simple.

    I´m attaching the fixed ObiClothPicker and will update the one in the store asap.

    cheers!
     

    Attached Files:

  19. Medto

    Medto

    Joined:
    Oct 28, 2015
    Posts:
    8
    Hello there,
    Before purchasing I wish to know if there is way to make it work with the steam vr plugin , I mean a way to use the handle script with the controllers like this video : https://twitter.com/Alientrap/status/788210172145565697

    I red the docs and the thread about the collisionhandle script made me wondering it's possible, I'm more a designer than a coder.
    thanks!

    PS: that guy is using Uflex
     
  20. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi,

    That video shows a soft body, which is currently not possible to simulate with any of the Obi plugins (cloth, rope or fluids).

    cheers,
     
    Flurgle likes this.
  21. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi everyone,

    Obi Rope 3.0 has finally been uploaded for review. Here's the store video, and our blog post detailing the most relevant additions:

    http://blog.virtualmethodstudio.com/2017/04/obi-rope-3-0-unity-whats-new/



    Imho is a quite flexible, robust, neat rope system. It can now do most of the stuff you would expect from ropes, and more: change length at runtime, strain-based tear generation, smooth spline-based geometry smoothing... and best of all, you can upgrade from 1.1 for free. No more rigidbody & joint based ropes that explode under the slightest tension.

    Hope you guys find it useful :)
     
  22. Medto

    Medto

    Joined:
    Oct 28, 2015
    Posts:
    8
    So finally I decided to purchase, I tried to bring the script "CollisionHandle.cs" into a project to but i have those error :

    Assets/CollisionHandle.cs(33,25): error CS1061: Type `Obi.ObiSolver.ObiCollisionEventArgs' does not contain a definition for `points' and no extension method `points' of type `Obi.ObiSolver.ObiCollisionEventArgs' could be found. Are you missing an assembly reference?

    Assets/CollisionHandle.cs(36,10): error CS1061: Type `Obi.ObiSolver.ObiCollisionEventArgs' does not contain a definition for `distances' and no extension method `distances' of type `Obi.ObiSolver.ObiCollisionEventArgs' could be found. Are you missing an assembly reference?

    Assets/CollisionHandle.cs(39,32): error CS1061: Type `Obi.ObiSolver.ObiCollisionEventArgs' does not contain a definition for `indices' and no extension method `indices' of type `Obi.ObiSolver.ObiCollisionEventArgs' could be found. Are you missing an assembly reference?

    Any Idea to solve this?

    Thanks
     
  23. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi,

    You said you tried to "bring CollisionHandle.cs into a project". Did you isolate this particular script? it needs the Obi.ObiSolver.ObiCollisionEventArgs class in order to work. If you have ObiSolver.cs in your project too (and it matches the same version of the plugin), then it will compile fine. You cannot just import a few scripts and expect it to compile.

    Edit: btw, there's no "CollisionHandle.cs" script included with Obi. The closest thing is "CollisionEventHandler.cs"

    cheers!
     
  24. vice39

    vice39

    Joined:
    Nov 11, 2016
    Posts:
    68
    Hi all,
    we are trying to make a squishy objects with Obi Cloth but having a hard time getting it to work on complex objects. I have a mesh with about 5k vertexes and a sphere in the same scene. One solver for both (it has enough Max particles). The sphere bounces on the floor and retains shape but the mesh will fall right though the floor. Again, they share a solver and the floor is defined as a collider in the solver.

    Any ideas?
     
  25. Medto

    Medto

    Joined:
    Oct 28, 2015
    Posts:
    8



    Hi, I was talking about this post : https://forum.unity3d.com/threads/o...h-back-to-unity-5.337322/page-10#post-2874549

    What I'm trying to do there, I just want to grab a particle through an handle created in real time, tu use it With my vive controller. I already tried some cloth elements in steam VR and it works great, is there a way to have an exemple to you was talking about related to the post?

    PS: I'm no looking for a high end smooth deformation like the gpu solution like Uflex, just enough to make people to believe it.

    Thank you
     
  26. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi there,

    Ensure the collision layers are set up properly (different layer for the cloth and the collider). See:
    http://obi.virtualmethodstudio.com/tutorials/collisions.html
     
  27. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi,

    That script was meant for Obi Cloth 2.x. Since 3.x you have the ObiClothDragger component, which does pretty much what you ask for. Just drag and drop it in your cloth object, you might have to modify it to work with VR in the specific way you want the user to interact with it.

    cheers,
     
    Medto likes this.
  28. KRGraphics

    KRGraphics

    Joined:
    Jan 5, 2010
    Posts:
    3,975

    This is beautiful... and gives me an excuse to create a huge monster with a humongous flail
     
  29. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,414
    Which platforms does this asset support? Any chance for xboxone or ps4? Are the core simulation solver compiled c++ native stuff?
     
  30. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Windows, OSX, iOS and Android.

    Yes, the core is a c++14 native lib.
     
  31. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    1,414
    Any chance if source code included so i can try and compile to the ps4 native plugin? I would be glad to work with you on that. Pm me if you are interested.
     
  32. hanso23

    hanso23

    Joined:
    Jul 22, 2012
    Posts:
    16
    Hey arkano22!

    Sorry if my question is kinda off-topic here, but I stumbled upon your great assets today. A quick question about Obi Fluids:

    Does it run on VR environments ( I'm currently developing a game for htc vive as main hardware target)
    Does the fluid have some kind of a weight? I'm thinking of a game scenario where the player has to fill up "water" into a bucket, and depending on how much of the fluid is inside it, it's getting heavier and a event-x is getting triggered..

    cheers
     
  33. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi there,

    ObiFluid does work in VR if you use separate cameras for each eye, and attach a fluid renderer to each one. No single-pass stereo rendering support as of now.

    Fluid behaves physically as you'd expect: it does have mass (you can specify its density, which is mass per volume unit), so it can push other objects around and be pushed by them. So if you fill a bucket with it, the bucket will get heavier. It also has other fluid-specific physical properties: viscosity, surface tension, vorticity, etc.
     
    Last edited: Apr 20, 2017
    hanso23 likes this.
  34. hanso23

    hanso23

    Joined:
    Jul 22, 2012
    Posts:
    16
    Perfect! Thank you so much for your fast reply!
     
    arkano22 likes this.
  35. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    652
    Hi Arkano. I just noticed that when I have Obi cloth running on my character, I no longer hit the OnAnimatorIK function at all. Basically IK stops working altogether. When I disable the solver and cloth sctips, IK starts working again.

    I guess this is a straight up bug?
     
  36. iddqd

    iddqd

    Joined:
    Apr 14, 2012
    Posts:
    396
    Obi Rope 3.0 looks amazing! Many thanks!
     
    arkano22 likes this.
  37. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Well, the only thing Obi does animation-wise is to call animator.Update() manually at an appropriate time during FixedUpdate(). The animation/IK update is 100% Unity's responsibility. If OnAnimatorIK is not called at all, it might be a bug in Unity, since it is called inside animator.Update() which we don´t have any control of. Will take a look at it though, to confirm this.
     
  38. Zomby138

    Zomby138

    Joined:
    Nov 3, 2009
    Posts:
    652
    I've commented out the code in ObiAnimatorController and set my animator to UpdatePhysics. At a glance it seems like everything works properly like this. OnAnimatorIK is working properly. Also, some of the root motion seemed to be messed up before, and this change seems to fix that too.

    Are there any problems with using this setup that you know of? I assume you have a reason for coding it this way rather than just setting the animator to UpdatePhysics.

    Btw I suspect that animator.playableGraph.Stop() is somehow stopping the IK.
     
  39. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Doing it like this will insert a 1-frame delay of simulation with respect to animation. May be fine for some cases, but in others where cloth must follow the animation tightly this delay will be noticeable. If you can live with it for your case, then I 'd say it's fine.

    IK should work even after calling Stop and then Update in the animator, since it is just a post-process of the bone animation and not dependent on previous animation frames. If it does not update IK when updating the animator manually, then I´m pretty sure it is a bug in Unity.
     
  40. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    Hello!

    I just purchased Obi Rope. Does that asset have its own thread?

    I'm just beginning to look at the tutorials, but first impression is that the asset is rather visually cluttered:



    One rope, which to me is physically one single object, is in Obi Rope represented by at least three different things (mesh, spline, handles), which you in the editor allow to be physically separated and that is an abstract concept I have as of yet a difficult time grasping.

    Now, the rope, in this weird visually disjointed state actually works and looks fine when I press play. It attaches to the two handles and everything else goes away. But it would be nice to have it look fine in the editor as well. I guess I have to manually move that white spline to the handle positions in order to do what's done automatically in the game, but how do I update the completely straight mesh representation?

    EDIT: Btw, I get constant warning about menu items which already exists, and I wasn't able to run the install script (got an error when I clicked the install button so I copied gizmos etc manually instead).
     
    Last edited: Apr 24, 2017
  41. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi Robert,

    You need to click "Initialize" in the rope inspector in order to make it match the spline shape. The rope and the spline are completely different objects. When you click initialize, particles and constraints are generated to create a rope that matches the spline's path. Think of the spline as a blueprint for generating ropes. You can even generate more than 1 rope from the same spline, and there's two different types of splines you can use to generate any rope.

    Why isn´t the rope updated automatically when you modify the spline, effectively making rope and spline the same thing?(this is a deliberate design choice). Well, you can modify per-particle properties of the rope using the particle editor: their mass, their radius, their fixed/unfixed state... this is all reset when you initialize the rope because new particles are generated to match the spline length, rope thickness, etc. Uniform density is assumed to assign initial particle masses. So updating the rope every time you move the spline would mean you lose all per-particle information. Having to re-do all the particle setup if you accidentally grab and move a spline control point seemed to be annoying at best, so we decided to make rope re-generation a explicit operation. It even asks you if you're sure you want to re-initialize the cloth, as you´ll lose all per-particle properties.

    ObiHandles group particles together under a different transform (you could simply fix particles in place if your handles do not move relative to one another). They are not part of the rope per se. When created they match the rope position, if you move them in the editor (where the rope is not simulated) and then press play the rope will "jump" to satisfy the positional constraint imposed by the handles.

    About the mesh and the rope: ropes can be visually represented by a mesh, a chain-like sequence of objects, or any other visual representation. It makes perfect sense for the visual and the physical representation of an object to be separate things, just like meshes, colliders and rigidbodies are separate entities in Obi.

    Recap:
    - Spline: rope blueprint, determines initial rope shape. Several types of splines can be used, and a single spline can spawn more than 1 rope.
    - Rope: physical representation of the rope, made out of particles and constraints. Each particle carries mass, radius, fixed status, optional constraints (like pin constraints).
    - Mesh/Chain: visual representation of a rope.

    Read the docs carefully, specially this:
    http://obi.virtualmethodstudio.com/tutorials/ropesetup.html
     
    Last edited: Apr 24, 2017
  42. ekergraphics

    ekergraphics

    Joined:
    Feb 22, 2017
    Posts:
    257
    I tried the asset again today, but I get a lot of warnings, and no spline was generated when I added the Obi Robe component (and both "Edit Particles" and "Initialize" was greyed out). I managed to generate a rope by manually adding the Obi Catmull Rom Curve and manually assigning the DefaultRopeSection, but I clearly remember rope thickness updating "live" as I dragged the slider yesterday and that did not happen today, and when I clicked to edit particles, there were super many packed incredibly dense, instead of the relatively few I experienced yesterday:

    I'm using Unity 5.6.0p1.
     
  43. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi,

    The warnings are due to obsolete methods that seem to have been introduced in p1, since in 5.5 and 5.6 UpdateIfDirtyOrScript doesn´t give any warnings. It is safe to ignore these warnings though, as we will update the method names in the next release, and the current methods work fine nevertheless. They're just marked as deprecated, not removed yet. There's been tons of API changes in Unity in the last couple minor releases.

    About the amount of particles in the rope, try chaning the "resolution" parameter of the rope, and reinitialize it. A value of 1 will put enough particles to make them overlap a bit. Lower values will progressively reduce the amount of particles in the rope.
     
  44. davide445

    davide445

    Joined:
    Mar 25, 2015
    Posts:
    138
    A complete newbie want to use Obi Cloth just to simplify my cloth animation process.
    Currently testing DAZ3D characters inside Unity, I got this result for cloth animation using Unity 5.5 f03

    Any way Obi Cloth allow me to resolve this problem, or I just need to better learn Unity cloth animation.
     
  45. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi there,

    Without knowing how you set this up in detail, it's pretty much imposible to tell why this happens, sorry. Anyway, this is a quite simple scene to get working correctly in Unity so Obi won´t make things easier for you compared to Unity's default cloth... probably the opposite.

    Obi works based on the same principles as Unity's cloth, but exposes many more parameters and is much more customizable. Unity's regular cloth is more than capable of handling your scene correctly, so I´d first focus on learning about cloth asset authoring and simulation before switching to a more advanced solver.
     
    davide445 likes this.
  46. Torrq

    Torrq

    Joined:
    Jan 10, 2014
    Posts:
    3
    ObiRope 3 Beginner question

    How do you set rope size? If I know I want a 2 meter rope, is there a straightforward method to do this?
    The 3 ways I have found so far are:
    • Set length by definition of Curve assigned to Rope. Have to use reference object and monkey with the tangent handles, but doable.

    • Can scale Transform X, Y, Z equally. But that changes width as well.

    • Add ObiRopeCursor script. Call ChangeLength. Only works at run-time.
     
    Last edited: Apr 28, 2017
  47. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610

    Hi Torrq,

    Initial rope length is defined by the spline you use. To change length at runtime you have to use ObiRopeCursor and call ChangeLength, just like you say. There aren´t many more options really, as this way you can set rope size both in the editor and at runtime. What do you need to achieve?

    The only way to do it that you didn´t mention is setting the Stretching Scale parameter of distance constraints. This will however increase the inter-particle distance, will not generate new particles/constraints as the ObiRopeCursor does, so it usually doesn´t count as "changing rope length". More like stretching it, actually.
     
  48. Torrq

    Torrq

    Joined:
    Jan 10, 2014
    Posts:
    3
    Thanks much, when using new product you sometimes wonder if your missing a best practice.
    For prototyping, I was trying to generate several ropes. 1 meter, 2 meter, etc...

    I could find no quick/verifiable way to make a set length. Besides modelling it in Unity editor, which takes some eyeballing.

    Where should we ask these Use Case questions? Here or the Taiga site?
     
  49. Medto

    Medto

    Joined:
    Oct 28, 2015
    Posts:
    8
    Hello there,
    So I purchased Obi rope, and I'm trying to attach a bunch of prefab lantern along the rope without any success, where is the bridge exemple in the version 3 ?? It will be a good start for what I'm trying to achieve here.
    Thanks!
     
  50. arkano22

    arkano22

    Joined:
    Sep 20, 2012
    Posts:
    610
    Hi there,

    Giving a set length can be done using Unity's grid as a reference when creating your rope. Anyway giving an exact length to a rope isn´t a common use case (afaik), because no matter how precise you are in your measurements the actual length will never be the one you set due to:

    - Numerical precision in spline parameterization. The calculated spline lenght will always be slightly smaller than its real length.
    - Discrete approximation of curve using particles. This further reduces actual rope length.
    - Iterative simulation convergence (or rather, its lack of it) won´t ensure an inextesible rope in the general case. This causes slightly stretchy ropes.

    We always appreciate it if you use Taiga, as some use case questions spawn issues or tasks that we can work on and get things slightly more organized, but we´ll try to answer asap no matter how you contact us.