by Julio Jerez » Wed Mar 31, 2021 11:05 am
The cost of the iterative solver is linear regardless of the type of joints.
The cost of open loop joints is also linear regardless of the joints.
The const of a articulated structure withe some close loop joint is o(n^3) on the number of row forming kinematic loop.
In general kinematic loops should be minimized or keep small by the design.
I give you an example, say you make a ragdoll with say 24 bones.
From the pelvis to each limb the each node only have a parent, so as long as the rag doll is not touching anything,
The cost of solving it is linear on the number of bones.
Now let us say the doll collide with the floor, each contact point has three rows, assuming each node collides and each node generate two contacts, that will be up to 24 bone time 6 rows = 144 rows, that's a 124× 124 rows to solve.
It is quite expensive, however since the kinematic loop solver has an initial guess solution, this value is determined but the iterative solver that is applied before, so in general even whe each pass is quadratic, it usually terminates in fewer that 10 to 20.
In the joint demo there is an example that shows a roller coster made of 20 solid all conected to the next by a point to point joint and each is conected to the sentinel.
This made the close loop matrix 60 x 60 and is work at a quite resonance speed.
Another example is a vehicle, each tire made one contact, plus ther are few internal close loop, like the motor, the gear box the differentials, the tire axel, all those are kinematic loop.
The matrix for close loop is about 24 x24 for a car with four tires, and is solved without problems. Not as fast as a raycast car would be but accurate and reliable enought to generate emerging natural car behavior by the simple laws of physic and still be practical for used in a simulation. Stuff like realistic rear wheel cars that exhibit vehavior like drift, tire burn out, tail spins are all emerging without having to hack it in.
In you example, the answer is the performance is not affected if the construction of joint is fixable, since a sentinel is a static body, so it will be a kinematic loop the moment there are more that one for a single Skeleton.
You may think that you can cheat and get away with kinematic loops by connecting each body that need to be conected to a the world to a different static body.
My recommendation is that you do not do that, it will result on many small close loops, each with few rows that will be linear combination of some other row, which will have an infinite number of solution.
In newton 3.14 I covered for that by making those connection to be a proxy of the sentinel. With newton 4 I not longer do that, I let the application make the judgment how to design the articulation.
The construction of open loop Skeleton is determined by a spawning graph algorithm that figure out all the Skeletons that are not connected to a static body and form an open loop.
Then for each Skeleton, in another pass it connect all the close loops joints.
These algorithms are use those joints option to figure out how to build the skeletons.
It is to the application to made a sound judgment as to how to form the articulated body.
It is possible to make a case the will bring the engine to its needs, for example a net or an array where each body is linked to every other body. I recently have the case of the connectivity of the debri piece of a template geometry.
Doing that, to me is a mental masturbation that make some one to make bragging point but that accomplished nothing, I leave to the other engines. I am only concerned with what is reasonable.