I don’t understand why you think I’m making assumptions about how they work, quite the opposite. I’m explaining that there shouldn’t be any difference in physics laws between the two systems, because this has nothing to do with the programming paradigm.
Since I don’t know the background of every developer, and some may come from non-physics-heavy fields like art, let me explain in simple terms:
In physics, there are some fundamental laws known as Newton’s laws of motion. The third law, the law of action and reaction, states that when two bodies interact, they exert forces on each other that are equal in magnitude and opposite in direction.
These laws must be followed by all physics engines, regardless of the programming paradigm or system in use. Friction is considered a force in physics, so when two objects experience friction, the forces must be equal in magnitude and opposite in direction. The only way to ensure this, when the two bodies have different materials with potentially different friction calculations, is to impose a specific ordering in how friction is resolved, so that the same rule applies to both bodies.
In Unity, this ordering is determined by comparing the values of the enum that defines the friction combine policy. If you had opened the package provided by the OP, you would see that this is indeed the case: there is an ordering mechanism for both physics systems. Without such ordering, the system would not be able to comply with Newton’s third law.
The difference in behavior arises from how this ordering is defined, it is implemented differently in the two enums. In PhysX, the enum is defined as follows:
public enum PhysicsMaterialCombine
{
Average = 0,
Multiply,
Minimum,
Maximum
}
and the ecs physics like this:
public enum CombinePolicy : byte
{
/// <summary> sqrt(a * b) </summary>
GeometricMean,
/// <summary> min(a, b) </summary>
Minimum,
/// <summary> max(a, b) </summary>
Maximum,
/// <summary> (a + b) / 2. </summary>
ArithmeticMean
}
I’m not sure why this happened, but there is no bug here, and no assumptions were made. There’s no reason the ECS system shouldn’t have an ordering mechanism, just like PhysX does, because this has nothing to do with the underlying systems or programming paradigm. It’s simply how physics works.
The difference lies in how the ordering is calculated, based on how the enums are defined. This results in different behaviors. In PhysX, the Minimum value takes precedence over Average, so the object keeps moving indefinitely. In ECS, Average takes precedence over Minimum, so the object comes to a stop after a while.
Again, whether it’s ECS or not doesn’t matter, physics laws remain the same. The approach used for GameObjects, where some form of ordering is applied to calculate friction, should also apply in ECS or any other physics system that handles friction differently across materials. Why Unity chose to implement a different ordering I don’t know, but no assumptions were made based on the system. This is just how physics works.