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. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    Wat is exactly wrong? Can you send a screenshot?
     
  2. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
  3. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Hi, first of all this is a great Asset, I've been using it for about 3 months now and I have created a TXrigidbody car, with TXrigidbody wheel hubs and soft body tires, I only wanted soft body tires for performance reasons. However, this is the problem, the softbody tires drag the wheels from the unity joint! which is a Configurable joint, projection on, I've played around with masses, different types of joint, time steps, setting the Inertial tensors up, everything, I've tried setting the tire masses to 10 and hubs to 20, hubs to 10, tire masses to 20, I've tried changing friction. I just can't get Truss softbody to work with Unity's built in joints without it stretching them? Anyone else have this problem?
     
  4. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    if you want soft tires only, not soft car body, you should connect wheels to very simple TxSoftbody with TxConstraint, and after this connect unity rigidbody car body to softbody with TxConstraint too
     
  5. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    Can someone make Tutorial video for cars ? :)
     
  6. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    This is what I thought of trying, but as I was building the Softbody hub to then attach to the rigid car body, well axle hub, I just thought wouldn't that just stretch the joints it's connecting to? I.e. the Axle hub which the brakes are part of, this would all be Rigidbodies, and the wheel hub (softbody) which it's connect to, from there the unity joints would stretch, just further down the line? Or am I missing something?
     
  7. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    I'm thinking of making a blog on my progress using soft body tires only, but there are many ways to build a car, my way has it's own problems I'm still trying to solve., my advice, just go for it, make it your own.
     
  8. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    I can do a bit of this, but I can not figure out how to link FL FR wheels to Truss
    I need a tutorial from someone to help me finally
     
  9. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    You create a single node on the car truss, and call it something like AxleFL, then on the wheel truss which is connected to the car body under constraint select the AxleFL in the node list, make sure 'connecting to' is set to node and not edge. If you download the RedCar demo you can study the prefab car, that has everything including how to create the steering as well. From what I can tell using all Softbodies for a car is straight forward, mixing soft and rigid for a car is a nightmare, if anything not possible from my experience.
     
  10. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Turns out ultimately you can not use Truss with Unity's built in Joints, as in mixing soft with rigid, joints are too soft, this includes all types of applications not just cars, apparently PhysX has an Articulation Joint which has been part of the PhysX library for many years, however Unity hasn't ever integrated it, this joint is solid, apparently truly solid. So this is a major flaw in the unity engine as a whole until they integrate the Articulation Joint. My project is on hold until this problem can be solved. I'm looking into using APEengine for the physics. Again this is not a Truss problem, this library is actually very promising, it's just not enough people are willing to spend the time studying it, instead of putting it down.
     
  11. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    I dont know i dont know i dont know :/
    I dont know HOW :( i need videotutorial
     
  12. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Have you downloaded the RedCar demo?
     
  13. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    Yes i have downloaded RedCar Demo
     
  14. paulprog

    paulprog

    Joined:
    Sep 8, 2013
    Posts:
    1
    Hello all, good job on the RedCar demo. Does anybody know how to fix the "sliding" of the car? it feels like it is constantly sliding and drifting. I tried to increse the friction values of the wheel matter but to no avail.

    By the way, to avoid the craches the onDestroy method should be:
    Code (CSharp):
    1. private void OnDestroy() {
    2.     if (TxWorld.created){
    3.         TxWorld.instance.onBeforeStep -= UpdateCar;
    4.     }
    5. }
     
    Last edited: Jan 15, 2019
    Fibonaccov likes this.
  15. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    I've created a car ground up using custom suspension and Unity joints but kept the tire objects only as Truss soft bodies, I don't get any crabbing, so I'd guess it's the design of the RedCar wheel truss, it's an odd shape maybe?
     
  16. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    I've tested the APE DeepMotion physics engine for Unity, the Articulation joints are stable and runs fast, but the physics are built ground up, so the base classes are extended from the Monobehaviour, so it doesn't interact with unity's Rigidbody, infact it has it's own Rigidbody, so Truss doesn't work with it! I wonder if there is a way of integrating Truss into DeepMotion physics code?
     
  17. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Okay here is my project so far using Truss soft body for the tires only, I've fixed the joints and in final stages of preparing for a demo video. This has required a *lot* of time the achieve but the results are well worth it, I will be rigging more vehicles soon, including Lamborghini Diablo, Ford F150 Raptor, 69 Dodge Charger and one Hyper car, all demonstrating different drive trains and tire setups, thicker walls etc and the potential for this soft body physics library, there is no additional code for the tires, just matter settings. For advise to anyone having trouble with Truss, don't give up, there are many ways to create applications with this library it just requires patients and imagination, there is no simple tutorial. Hearbroken, is there no way to come back and spend more time on it?
    JointSolution1.jpg JointSolution2.jpg
    JointSolution3.jpg
     
    Fibonaccov likes this.
  18. Lesnikus5

    Lesnikus5

    Joined:
    May 20, 2016
    Posts:
    131
    Can anyone post a link to download Red Car Demo? That most legendary, ideal, to which everyone is trying to come, but no one succeeds. I just want to drive, it's so nice! But I lost it on my computer. :(:(:(
     
  19. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Can anyone confirm that the Mesh Collider side of this engine isn't functioning properly before I waste anymore time, doesn't matter what I do I can not get a mesh collider TXRigidbody to behave properly, it flys around the world uncontrollably?! If it does function properly how to hell do you get it to work? It only works if the mesh is a cube, as soon as you change any angle of the cube the physics screws up!
     
  20. TokyoWarfareProject

    TokyoWarfareProject

    Joined:
    Jun 20, 2018
    Posts:
    814
    red car demo will never be public very likely to avoid the pest of asset flippers or the onew looking for a quick buck. This is a complex aset? yes, but it does deliver
     
  21. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    I think redcar demo don't helps to understand or create something like redcar. It will give more questions than answers. Please look carefully on the Truss examples and try to understand the idea of truss physics. There is no simple way to create car with truss physics. You will never create car or something like car until you understand the basics. First of all try to create car body without wheels and setup deformation for it. I'll take some screenshots to help you understand
     
    TokyoWarfareProject likes this.
  22. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    upload_2019-2-4_19-2-24.png

    upload_2019-2-4_19-3-7.png
    upload_2019-2-4_19-3-35.png
    upload_2019-2-4_19-3-58.png

    The basic idea - truss body is not a jacket. It's not like a mesh in 3D graphics. Mesh in 3D graphics is like a tent jacket, and truss body is like a tent with support axles. This axles calls links, and joints calls nodes. You have to create stable truss body with links and nodes, and then create jacket - faces. It's outer shell of truss body

    upload_2019-2-4_19-9-43.png


    It's the only way to setup car body
     
    TokyoWarfareProject likes this.
  23. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Yeah this is how you do it, and for me the Red Car demo did shed a lot of light, but basically it's just like the Beam physics and there is tons of resources to do this, and it works! The hard part I'm finding is using this physics engine with Rigidbodies, there just isn't much out there to work with, no examples on how to import a mesh properly to use as a collider, I've done everything, Reset xforms, no rotations, centered perfect at 0,0,0, pivot set to 0,0,0 yet it works fine with a basic cube but nothing else? The objects just fly around and don't collide properly, yet when I switch TXRigidbody off it collides just fine with the Unity physics :/ And the Rigidbody settings are exactly the same as the examples. Need an example of how to use a MeshCollider Rigidbody, and I don't think it supports more than 1 box collider either, because I've tried that and it has the same side effects as a MeshCollider, switch them off, use 1 collider and it works properly.
     
  24. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    I don't use Truss physics with regular Unity physics or colliders. So I can't tell you how to use meshcollider rigidbody with truss
     
  25. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    This is the impression I'm getting so far with regards to this physics engine, most people use it with 100% Soft body objects, doesn't seem to be much testing with rigid bodies. I won't give up but I'm not seeing anything good to come of this, I'm testing it 7 hours a day and the conclusion is looking bleak.
     
  26. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    It looks like this engine only supports primitives for Rigidbodies, spheres, cubes and cylinders all work fine, even exported from a 3D package, as soon as you start adjusting the vertexes and re-export the physics begin to get worse the more you adjust the shape.

    Added: Also doesn't support multiple Cube colliders, this was last resort to get over it not supporting Convex Hull collisions. Unless there is an answer to this problem it's pretty much useless for any application that wants to use Soft and Rigid support.
     
    Last edited: Feb 5, 2019
  27. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    You have Car Control ? (truss )
     
  28. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    The RedCar demo has a car controller, it has everything you need to learn how to build a car Truss and a Vehicle Controller Truss.
     
    Fibonaccov and Shadow-X6 like this.
  29. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    I create my own car controller for my purposes. It's not very hard
     
  30. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    He's going to ask you for it lol.
     
    n00b_013 likes this.
  31. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    I've been looking at your project and I believe there is 2 problems with creating a vehicle wheel with 100% softbody, unless you can figure out, which I couldn't, separating the wheel hub from the tire, as 2 seperate softbody objects, like BeamNG.drive, I think your wheels are all 1 soft body, and you can actually see the hub *deform* this also causes the issue of tire separation from hub on collision. Where I've used a rigid hub and softbody tire these 2 problems are easy to solve.
     
  32. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    As you can see in soft tire demo, wheel hub is not deforms when tire deforms. Yes, wheel is 1 softbody, but wheel hub has more links and these links has more stiffness than tire links, and wheel has internal pressure. Not necessary to create separate tire and hub

    upload_2019-2-6_18-50-3.png
     
  33. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Yes I was thinking of doing it this way, the way the Red car demo does it, I've notice there your tires have actual mesh tire tread, that must run slow with TXSoftbody?
     
  34. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    It runs about 400fps with 1 car is scene and box as a ground on i3 8100 and gtx1060 3gb
     
  35. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Have you tested it on an average system yet? one thing you don't want to do is get heavily into development and find it only runs on your computer.
     
  36. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    ASDev
    A quick question about your project so far, are you experiencing any issues with the tire behavior at higher speeds, for example does your vehicles reach their top speeds in the right amount of time and do they steer properly at higher speeds? I'm finding my tires don't steer correctly at high speed, maybe to do with fast rotations?
     
  37. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    Yes please
    Contact : Facerougex@gmail.com
    Thanks :)
     
  38. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    I tested it on GT930, but I don't remember results. It was about 150FPS, without freezes. But on mobile devices softbody tires causes freezes about 2-3FPS. So it unusable in mobile projects for now
     
  39. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    It steer correctly, but I have issue with collisions at high speeds. Cars are stick together and rotate with abnormal speeds, and Unity crashes. I think I need to create some limitations with speeds
     
  40. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    This is normal I think, BeamNG lost their contract to the new cry engine due to bugs, and even now you can see the issues in their demos, sticking together on crashes, mesh explosions. Instead of limiting speed how about increasing Truss substep power or Unity iterations, and maybe reducing how much the meshes crush, make them more rigid.
     
  41. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    Truss substep and unity iterations or other scene settings doesn't take effect. I cant decide which genre to choose for my project to show capability of Truss physics
     
    Last edited: Feb 8, 2019
  42. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    A game that demonstrates the physics engine on more than 1 vehicle, I'm making a Forza style game, as you can tell from the screens shot I posted on this page. I think there needs to be a Tire class made specifically for truss and vehicles, we need an optimized contact patch for tires, so only the contact patch is calculating the physics.
     
  43. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
    Hi you can contact me ? :)
     
  44. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Okay I'
    Okay I'm setting my vehicles up using Softbodies, but I'm noticing new crashes and unity hangs, mostly when I started setting up Motors in the Constraints, have you solved this problem in your project? It crashes or hangs when I hit Play and sometimes hangs on startup, this has only just started since using constraints with motor enabled.
     
  45. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    How you links wheels to body? Can you take a screenshot with constraint settings and scene?
     
  46. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Okay, I had 2 soft body parts to the wheel, center hub no internal pressure, outer soft tire with pressure. Now, the only way I could think of constraining them together was with each node on the outside of the rim to each node on the outside of the tire, on both sides, so there where 18 nodes on the left and 18 on the right, so center hub had 36 node constraints and the tire had 36 node constraints, this holds them together, with collision off. This works as it is but when I add a motor to the wheel it crashed on hitting play. Since changing to to all 1 soft body there has been no crashes, so I'm guessing it was the 36 constraint nodes?
     
  47. khos

    khos

    Joined:
    May 10, 2016
    Posts:
    1,490
    This is some very nice work! Would you be willing to share some how to's , for the community? I think that would be very helpful for a lot of people. I can understand if not :)
     
  48. ASDev

    ASDev

    Joined:
    Dec 9, 2012
    Posts:
    48
    I'm using wheel with 1 softbody and internal pressure. Hub has more solid links and it looks pretty good. I'm not using 2 softbodies for 1 wheel
     
  49. Shadow-X6

    Shadow-X6

    Joined:
    Apr 29, 2016
    Posts:
    108
  50. AlanEvo

    AlanEvo

    Joined:
    Mar 29, 2018
    Posts:
    113
    Thank you :) Yes I certainly will, I'll get some videos up soon on some how too's. Anything specific?
     
    khos likes this.
Thread Status:
Not open for further replies.