Search Unity

[RELEASED] Truss Physics for Unity3D. Soft-body simulation plugin.

Discussion in 'Assets and Asset Store' started by Heartbroken, Aug 22, 2015.

Thread Status:
Not open for further replies.
  1. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    @mensch.mueller
    Yes, it's a good idea. I'll add this to my backlog.
    Btw, as the integration code is open, anyone with some C# skills can extend the editor functionality. Any contributions would be highly appreciated :)
     
  2. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Thanks you so much Michael. Heartbroken helped me with the truss a lot. I second the node snap to geometry demand. Allowing unity built int snap by pressin V could be a fast way to implement it

    Michael where you able to assing the chasis to physycs car using constraints?
     
  3. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Trying to replicate your rig with no luck.
    So you created a node group with your 5 nodes and in the constraint you assigned this group right? What values did the constraint have?

    I'm traing to do the same but if I do select 5 nodes from teh base the rest of the car collapses but these points and if I assign all the nodes to the constraint the shape of the chassis is ok but there is no deformation.

    I'm using edy vehicle physycs witch has a similar structure than yours.
     
  4. mensch-mueller

    mensch-mueller

    Joined:
    Nov 25, 2014
    Posts:
    156
    Hey TooManySugar
    No, i just did a basic truss-setup with the parts you see in picture. It now deforms right when it falls down on cubes with Tx Static Body(Scripts) assigned to it. For a real car setup i would like to have some kind of tutorial from heartbroken ;). That is really beyond my skill. We are just(hopefully) looking forward to tutorials, setting up this advanced things(like suspension, moving tires,etc). That would be really helpful beyond a car setup :)



    Cheers Michael
     
  5. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Hi Michael.

    Yeah, but instead of having to setup suspensiong etc from zero it should be easyer to integrate into an existing vehicle platform. As
    Soul-Challenger did by using constraints.
     
  6. AlenBrk

    AlenBrk

    Joined:
    Feb 17, 2014
    Posts:
    33
    I like it! Have you tested it on mobile?
     
  7. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Thanks! Yes, I have )
     
  8. Soul-Challenger

    Soul-Challenger

    Joined:
    Dec 30, 2010
    Posts:
    152
     
    Fibonaccov likes this.
  9. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Thanks!!. Already achieved some ressults but still some isues are I will compare with your setup.
     
  10. AwesomeX

    AwesomeX

    Joined:
    Sep 10, 2013
    Posts:
    116
    Any hopes of you uploading the Red Car example files? I'd love to toy around with just creating different tracks to crush the car in. :D
     
    Lesnikus likes this.
  11. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    I have this in my plans. Can't name the exact date though.
     
    AwesomeX and Lesnikus like this.
  12. AlenBrk

    AlenBrk

    Joined:
    Feb 17, 2014
    Posts:
    33
    It is really hard to create a car setup.. can't get it working.. :confused: Tutorial would be great! :)
     
  13. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    You need to focuss on the setup of the truss.
    Dont go mad in complexity. Do a simplified truss version of ones shown in this thread. Something with 8 nodes can make a car deform-
    for initial testing at least.
     
  14. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Yes it would :) I'm going to make it just need to finish a couple of other things.
     
    AlenBrk likes this.
  15. AlenBrk

    AlenBrk

    Joined:
    Feb 17, 2014
    Posts:
    33
    Thanks, i was trying to use the 2nd demo (Deformation) Only attached the TX Soft Body.. but when i hit play i just explode and disapear.. but i have to much nodes.. i will try with 8.
     
  16. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Not sure about what you're doing. But if you use an existing truss of another object it will not work. I mean, unless the node network more or less fits your object it will make strange things.

    If you mean that the fresh demo explodes when hitting play it might be worth reimporting in a fresh project as I tested all the demos and worked. At least in 1.0. I saw there is a newer version in teh store don´t now if a bug whent withing that v.
     
  17. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    I could try to help if you describe better what you're trying to make.
     
  18. AlenBrk

    AlenBrk

    Joined:
    Feb 17, 2014
    Posts:
    33
    Hi,

    No sry the Demo is working very well,
    yes i was using an existing truss from the cube object.
    Now i have created the Nodes manually..
    When i hit Play, the car disappears.. Maybe i am misunderstanding the whole truss thing..
     

    Attached Files:

  19. TooManySugar

    TooManySugar

    Joined:
    Aug 2, 2015
    Posts:
    864
    Now you've to connect the nodes forming a Truss. Like in teh pictures other people has posted in this thread. Then you've to create the faces.
     
  20. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Yes, faces are missing. Not sure if it can work without faces at all.
    Could you show the links as well?
     
  21. Landkriecher

    Landkriecher

    Joined:
    Oct 18, 2015
    Posts:
    1
    Hey heartbroken,

    First of all big thanks for your work!
    But now my little problem: At the moment i am trying to install smth like a scalpel, which is moving with the mouse coursor. First it should just deform my cylinder, in later stages of my program it should cut it after an elastic deformation. It should simulate the human skin. But i am still struggle with the softbody reactions of my cylinder while the scalpel is moving, because it doesnt detect a collision and act like it is on trigger. I tried to move the collision box center in different scripts with the position of my cube (scalpel), but it doesent work. Do you have any hints for a soloution of my problem?


    Heartbroken.JPG
     
  22. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Hi Landkriecher,

    As for the collision detection, please check that your rigid body in addition to Unity's Rigidbody component also has Tx Rigid Body component added. Also note that your rigid body shouldn't have any scale.

    As for the soft bodies cutting, Truss Physics doesn't support this and I doubt it will as this requires completely different approach in the simulation.

    Cheers
     
    Landkriecher likes this.
  23. sashahush

    sashahush

    Joined:
    Sep 5, 2012
    Posts:
    75
    This looks extremely promising, is there a full car/vehicle setup tutorial yet?
    That would def make me purchase this asset, do to time constraints of trying to figure this out.
     
    StephenL likes this.
  24. crudeMe

    crudeMe

    Joined:
    Jul 8, 2015
    Posts:
    92
    Is that okay that both car demo standalone and .unitypackage from website are not working properly? I mean, they could've been outdated.
    At the demo, there is just a huge sphere falling down far above the car and nothing is moving or reacting to any keyboard input. At the package, there is a continuing errors all over the scenes, which leads to editor glitches. It's 5.2.2.
    This project seems really interesting. I wish I could try it out.
     
  25. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    No, the tutorial isn't ready yet.
     
  26. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    The demo and the package should work on modern hardware. There can be a problem with old AMD CPUs with no SSE4.1 support. I know about that and I could remove SSE4.1 instructions usage (it's actually only _mm_dp_ps for dot product), but this will degrade the performance, and also I don't have proper hardware for testing. So I just wait while all people finally upgrade their PCs :)
     
  27. 5T4RD35TR0Y3R

    5T4RD35TR0Y3R

    Joined:
    Sep 20, 2015
    Posts:
    1
    Anyone created example similar to RedCarDemo?
     
  28. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    Hello Heartbroken ,
    I watched the video demos of your asset and looks fantastic.
    By the way, thanks for the trial version.

    I would like to know if your asset works with "Edy's Vehicle Physic (EVP)" wheels.
    EVP use "wheelColliders".

    Thanks for your great work.
     
  29. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Hello mkgm, thanks. Yes, it works with EVP.
     
  30. PitHeimes

    PitHeimes

    Joined:
    Oct 18, 2015
    Posts:
    322
    Hey,

    awesome asset. Really love it.

    Just a quick question:
    Any way to get joints working correctliy with Tx RigidBodies. Tried multiple ways but it always behaviour drives crazy all the time.
     
  31. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Hi, thanks

    Yes, it needs some care but usually it's possible. Can you show what you're making?
     
  32. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Hi all!

    Just want to point a couple of videos from two projects I like a lot. They both use Truss Physics but in quite different ways:

    - Tank combats in cities. Truss Physics handles parked cars which are so fun to crash :)


    - Realistic Vehicle Physics. Truss Physics makes the vehicle's soft tires. Looks really cool :)


    I can't tell how happy I am that Truss Physics can be used to make such great things.

    Thank you guys!

    Merry Christmas to all and happy New Year!
     
  33. radimoto

    radimoto

    Joined:
    Aug 23, 2012
    Posts:
    257
    Merry Xmas @Heartbroken !

    I was wondering are there any plans for auto-rigging? Like a helper script that can automatically rig a car for example?
     
  34. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Yes it's a good idea. I'll think what I can do.
     
  35. killer1171090

    killer1171090

    Joined:
    Feb 23, 2013
    Posts:
    145
    Hey i am using the free version of truss physics with unity 5.1.1.
    But every time i add a soft body to my tires and press play unity slows down and crashes.
    Also are there any tutorials on creating cars?

    Edit:
    I think i found out why it was crashing.
     
    Last edited: Dec 26, 2015
  36. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Hi. And why it was crashing?
     
  37. Lesnikus

    Lesnikus

    Joined:
    Aug 29, 2015
    Posts:
    47
    Heartbroken,
    why do not you put the source codes of "Red car demo" in the project? I will buy "Truss Physics" only if it will contain a ready car. I do not understand why you do not do?

    What do we now have: a long time to finalize.
    I lost a lot of time. Because you do not put the "red car demo" into the project. The result of my work will be unpredictable. If everything is clear with the body, how to make a wheel soft tires, I do not understand!

    I want to get the working car system. Take Prefab, replace the mesh body and wheels, has a new Prefab with soft carbody and tires.The most convenient ability to simply add the source codes of "red car" into Asset, then we will have to pick it and do their cars.
     
  38. killer1171090

    killer1171090

    Joined:
    Feb 23, 2013
    Posts:
    145
    I had 2 objects with the same soft body script i copy pasted them over and just changed the mesh on 1 but not the asset so it changed it on both and crashed not certain if that's the case but the best i can find.
     
  39. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    @Heartbroken,
    would be great to have "Race demo car" demo and Video tutorials.
     
  40. Mehrdad995

    Mehrdad995

    Joined:
    Jul 17, 2013
    Posts:
    46
    the same here
    confused how to rig a car
    so the red car demo example could be really helpful
    thanks in advance
     
  41. AlphaGarg8447

    AlphaGarg8447

    Joined:
    Jul 28, 2013
    Posts:
    20
    Unity 4 should not be abandoned. I still use it and plan to use it for a very long time, until Unity 5 actually does something I can't find a way around. It may be easier for plugins to work in it, but scripting on it just seems to take more time because of the removal of some shortcuts and such. So yeah, still thinking if I should buy this or not. Make it 5 only, lose some customers.
     
  42. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    Pretty neat project especially considering the BeamNG people have become rather distracted by "Drive" and have not released any middleware. Are your units (Spring, Damping, Mass, Pressure) in SI (Newtons, KG, Pascals)?

    It has been an near unlimited source of frustration for me that everything Rigidbody in Unity is indeed in SI units except for Joints which pretty much do whatever they want and scale force based on the masses of the two objects.
     
  43. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Thanks. Yes, in SI.
     
  44. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    Do you expect to add support for Transform:Scale? Or have I missed it? Currently anything other than 1.0 Scale appears to cause problems but of course Scale comes in pretty handy for reusing assets.
     
  45. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    For the moment I don't plan to support scale. It's to hard to handle scale in physics simulation especially when parenting is used and parent scale can affect children. And if it's non-uniform scale... It's too many problems for quite a small advantage, as I see it.
     
  46. mkgm

    mkgm

    Joined:
    Apr 10, 2015
    Posts:
    134
    @Heartbroken,
    it's in your road map to release the "Race demo car" ?
    And what about Video tutorials?

    Please, be kind by answering my questions.

    Thank you so much for your great work.
     
  47. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    Yes, I plan to do this when I have more free time.
     
  48. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    "For the moment I don't plan to support scale." "It's too many problems for quite a small advantage, as I see it."

    I can see how it would be a performance problem if nothing else. ...but It's pretty huge if you need it. The most obvious usecase I see is tires and wheels. ...although I've yet to try and rig up a proper tire and wheel in your system.

    I assume it wouldn't be too hard to scale the Model, Collider, and Truss upon instantiation (recursive on children) if the GO is non-1.0 scale, then set the GO back to 1,1,1 when finished. It wouldn't allow for real-time scale but at least it would better allow for the reuse of assets.

    ...and maybe some way to scale the truss node masses (probably not by the transform scale though)... I can see it now =)
     
  49. Goblox

    Goblox

    Joined:
    Nov 3, 2012
    Posts:
    178
    I expect you've run into problems using rotating softbodies at high speeds (e.g., tires)? I noticed the RedCar starts crabbing at relatively low speed. Maybe you've already considered this... and hopefully it's on your roadmap but just in case:

    As rotational velocity approaches the limits of sim-speed, you could have a special type (HighAngVSoftBody) that would transition to an alternate physics model that largely relies on the softbody as a more accurate collider allowing you to keep the node velocities below the rate of mathematical instability. At high speeds mechanical locking (tire enveloping an object) becomes negligible so, at least for friction, the softbody only needs to model the contact patch. *Edit ...I assume you might need to more tightly couple a "HighAngVSoftBody" with a Constraint.

    Of course one of the big problems with this is keeping track of energy and forces for the softbody while "IT" is rotating faster in the alternate physics model. Obviously you have to start keeping track of force, rotational velocity, precession and such. ...which is all trivial. The tricky part I think would be combining it with the softbody simulation to keep as much softbody goodness as possible. I would expect you would still want to keep the softbody rotating and interacting with it's constraint close to the sim speed limit. Of course the forces coming out of the alternate model still need to be applied to the nodes of the softbody so that it deforms as accurately as possible. ...and how do you handle what percentage of precession force is coming from the softbody and what percentage is coming from the alternate sim? I don't know off the top of my head.

    This seems pretty well inside the scope of your project. The BeamNG guys ran into the same problem (softbody tires at high angular velocities), I'm not sure if they did this or not.

    We would need a lot of properties exposed through the API to have much hope of doing a good job of this outside of the library... but for highspeed vehicle simulations, surely the problem has to be addressed?

    The idea of having a complex deformable collider for a tire is really exciting. As the mesh gets more complex it gets us closer to everything Pacejka is trying to produce (and then some) with a relatively simple (static/kinetic friction) bruteforce simulation.

    With that said, exposing some simple stuff through the API like Constraint Force, avgSliprate, and CollidedObject(s) for (at least) each softbody would be be extremely valuable. Also Link Compression Rate would be nice. Eventually a collection of nodes/faces in collision along with normal force and sliprate per node/face would be AWESOME.

    Also, I'm working on a procedural tire generator that I'd be willing to donate. By the way, is it just high damping rates or is your math more stable than BeamNG? The last time I messed with .Drive even the trucks were a jiggly-jello mess.
     
    Last edited: Jan 22, 2016
  50. Heartbroken

    Heartbroken

    Joined:
    Nov 18, 2012
    Posts:
    132
    @Goblox
    It is more stable. The stability is always my #1 priority.
    All contributions are welcome :)

    You can get current length and plastic deformation of each link:
    http://heartbroken.bitbucket.org/trussphysics/document/scripting-api/txsoftbody/linklength/
    http://heartbroken.bitbucket.org/trussphysics/document/scripting-api/txsoftbody/linkplastic/
    The collision information is available in TxSoftBody.onCollision event:
    http://heartbroken.bitbucket.org/trussphysics/document/scripting-api/txsoftbody/oncollision/

    Not sure about the special tire physics. Truss Physics is a general purpose physics engine, it's not a car simulation library. But I'm currently experimenting with a new integration algorithm which works better with fast rotating bodies. The results look promising.

    As for the scaling support, I understand it could be more convenient with it than without it, but I'd better invest my time in more cool features like air drag, wind, water, mud like in BeamNG, and so on.
     
    AndersOrum likes this.
Thread Status:
Not open for further replies.