Truss Physics is a Unity3D extension package. Its purpose is the soft-body simulation. The soft bodies in Truss Physics are represented by mass-springs systems with optional internal pressure which allows to simulate a wide range of materials from jelly-like and springy to almost rigid but deformable. The simulation is done on CPU with extensive usage of SIMD and muli-threading optimizations.
Downloaded the evaluation copy(btw nice to have the opportunity to try it out! :)), and the cute car from assetstore, dissembled the car model, and tried out to set up a working soft body with truss physics.
This all went well and now i´m nearly satisfied with the behavior of car bodyâŚ
What i discovered in the process:
Really would like to have a tutorial, about the car setup, in which you set up the different parts, and share some knowledge of placing the nodes, and the way to connect them for their purpose. This could be easily split in more partsâŚ
I myself, have first setup only the hull of car, this gives funny effects, but i had connect the links to the center, to get some stiffness!
Some thoughts which could be implemented:
I saw that i can create a truss from mesh and probably it would be faster, but i have done it manually.
Symmetric editing? For nodes and links - most of the objects have some kind of symmetry!) ?
Selecting more elements with shift key?
Also one group should be there by default: All!
I noticed that i can give different values to the links. I think some kind of visual feedback would be nice, the simplest would be coloring of links. Set the range and colors and then visualize it. Sure the density of links is important tooâŚ
I was pretty unsure about the values, perhaps some calculation of volume and how many links are assigned and then choose a standard (metal, rubberâŚ.) and from that some fine-tuning.
It would be good to have a fade off time in addition to deactivation time.
Overall an impressive package, and really giving opportunities not available before. A sure purchase this week. Looking forward to the evolution of truss physics.
Sorry, my tutorials arenât ready yet, so for the moment I can only refer to BeamNG wiki. BeamNG is a great project which, as anyone can guess, was the inspiration for Truss Physics, and as BeamNG already has a lot of cool stuff, itâs a great place to get the idea of what mass-springs systems can be used for.
Check for example BeamNGâs tutorial for vehicle creation:
Thanks for your suggestions as well, I put them on the backlog. Just a couple of moments:
You can mirror selected vertices by applying the transform with âCloneâ option checked and âScaleâ equal to -1 along axis of symmetry.
You can select several elements by clicking them while holding ctrl key. I thought itâs how it usually works in Unity, no?
Anyways, thanks for taking time to check Truss Physics. I really appreciate that
I tried it as well. Is there a way to cap cpu usage? If you have traffic, 25 cars will take it down to 10 fps on my pc. Like deactivating it if nothing is colliding yet? Would you need to use a standard collider and a rigidbody as well?
How did you set up your red car? I canât seem to move the softbody, neither via transform nor via rigidbody and forces.
Truss Physics is not a car simulation library. It is a general purpose soft-body simulation engine. It is possible to use it to model different things including vehicles, though there are for sure much easier and cheaper ways to do this.
For the CPU usage you can define TX_SHOWTIMING symbol in the player settings, this will output the simulation and interpolation time onto the game screen.
You also can use Unityâs profiler. BehaviourUpdate->TxWorld.Update should show the Truss Physics timing.
You can use standard collides and rigid bodies if you want though itâs not mandatory. Truss Physics can work without them.
I know how to profile it, the question was about capping
I know that it isnât a car simulation library, I have my own for that and I am searching for good deformation. Your solutions looks and handles exactly like I wanted it to, is easy to edit and the results look good, but I canât seem to get it attached to my car rigidbody, so that the car is taking its deformable parts with it, thatâs why I asked about the red car demo
To attach a soft body to a rigid body you use Tx Constraint component
Your rigid body should have Tx Rigid Body component attached
Truss asset of your soft body should have a named set with nodes you want to attach to the rigid body. This is done in Truss Designer
When this all is ready, in the soft-bodyâs constraint component you set the Base Body property as your rigid body, add a snap, and set the snap nodes property as the nodes set youâve prepared in previous step.
Thatâs about it. Should work.
I will publish RedCar demo but later. Itâs not ready yet.
I am not a native speaker, maybe I will find another word
To set a value of how much cpu it is using, if it is using too much, to scale simulation down a bit.
I tried deactivating the whole tx soft body when not in use, but the mesh got resetted to the original state.
Ok I see. But I donât have such thing. You can tell engine how many worker threads itâs allowed to create, but besides this it will use as much CPU as it needs to run the simulation.
You can try to use TxSoftBody.Disable()/TxSoftBody.Enable() functions to pause the simulation of soft bodies you currently donât need.
Yes. Default value -2 means that Truss Physics will create a worker thread for each hardware thread except two which it leaves for Unityâs main thread and rendering thread.
I find Truss to be very usable indeed. One suggestion would be to add the possibility make groups of links (and assign different colors to each group) with a visibility toggle. Right now it can get a bit messy visually, when editing an object with many links.
Managed to integrate Truss to my rigidbody-based car
Had some worries because the SoftBodyâs transform would lag behind the RigidBodyâs transform at higher speeds. Changing Interpolate to âinterpolateâ instead of ânoneâ fixed that.
Thanks for posting the BeamNG wiki info. That will come in handy.
Performance-wise, I think itâs pretty fine. Tested ten cars with softbodies (Fixed Timestep = 0.02)
This looks brilliant, are there any figures on how it performs on mobile devices, like roughly how many links and nodes could I have in a scene? Would love to use this on my cars to do damage, do you think it would be feasible to have two cars similar to the red car demo running on mobile devices?
Iâm happy to hear it works for you. Would be great to see it in your game when you have something to show
You can make groups of nodes, links or faces in Truss Designer (named sets), but itâs not clear how to color them as they can intersect. Yes itâs hard to edit a truss with many links, but you can hide some of them and only leave those youâre editing.
Right, Truss Physics always interpolates the soft bodies transforms. This matches the rigid body âInterpolateâ mode. I thought to make a mode without interpolation but as the interpolation is quite cheep I left it for the future.
Thanks. No I donât have any figures for performance on mobiles yet. I hope someone will try it and share
There are several things which affect performance - except the number of links and nodes itâs the simulation step size and the number of iterations. RedCar will hardly work good on mobiles because of its soft-body wheels. Wheels can rotate very fast and to work properly their require quite small simulation step. But if you make a usual rigid body car with only deformable frame attached on top of it, it will be much cheaper and, I believe, should work on mobiles too. Though I didnât try.