默认求解器迭代意味着什么?

What does Default Solver Iteration Means?

我正在尝试了解 Unity Physics 引擎 (PhysX),有人可以解释一下 Default Solver IterationsDefault Solver Velocity Iterations[=23 到底是什么=]是?

这是来自 Unity 文档:

Default Solver Iterations: Define how many solver processes Unity runs on every physics frame. Solvers are small physics engine tasks which determine a number of physics interactions, such as the movements of joints or managing contact between overlapping Rigidbody components. This affects the quality of the solver output and it’s advisable to change the property in case non-default Time.fixedDeltaTime is used, or the configuration is extra demanding. Typically, it’s used to reduce the jitter resulting from joints or contacts.

请提供一些示例它是如何工作的以及增加或减少它如何影响最终结果?

我在 Unity 论坛上问了这个问题,Hyblademin 回答了这个问题:

In mathematics, an iterative solution method is any algorithm which approximately solves a system of unknown values like [x1, x2, x3 ... xn] by repeating a set of steps (iterating). Often, the system of interest is a set of linear equations exactly like those seen in algebra class but with a prohibitively high number of unknowns.

Starting with a guess for the solution to each unknown, which could be based on a similar, known system or could be from a common starting point like [1, 1, 1 ... 1], a procedure is carried out which gives an approximate solution which will be closer to the exact values. After only one iteration, the approximation won't be a very good one unless the initial guess was already close. But the procedure can be repeated with the first approximation as the new input, which will give a closer approximation.

After repeating a few more times, we can expect a reliable approximation. It still isn't exact, which we could confirm by just plugging in our answers into our original system and seeing that it isn't quite right (after simplifying, we would end up with things like 10=10.001 or something to that effect). That said, if the approximation is close enough for our application, we stop iterating and use it.

These lecture notes courtesy of a Notre Dame course give a nice example of this in action using the well-known Jacobi method. Carrying out an iteration of an iterative method outputs an approximation that is better than the input because the methods are defined in a way that causes this to happen, and this is a property called convergence. When looking at why any given method converges, things get abstract pretty quickly. I think this is outside the scope of your question, especially since I don't know what method(s) Unity uses anyway.

When physics is calculated in Unity, we end up with a lot of systems of equations. We could draw a free-body diagram to show forces and torques during a collision for a given FixedUpdate in a Unity runtime to show this. We could try to solve them "directly", which means to use logical relationships to determine the exact results of the values (like solving for x in algebra class), but even if the systems are on the simple side, doing a lot of them will slow the execution to a crawl. Luckily, iterative, "indirect" methods can be used to get a pretty good approximation at a fraction of the computing cost.

Increasing the number of iterations will lead to more precise approximate solutions. There is a point where increasing the number of iterations gives an increase in precision that is not at all worth the processing overhead of doing another iteration. But the number of iterations for this point depends on what you need your project to do. Sometimes a given arrangement of physics objects will result in jitter with the default settings that might be improved with more solver iterations, which is mentioned in the manual entry. There isn't a great way to determine if changing solver iteration counts will improve behavior or performance in the way that you need, except for just trial and error (use the Profiler for a more-objective indication of performance impact).

https://forum.unity.com/threads/what-does-default-solver-iteration-means.673912/#post-4512004