- #1
chudd88
- 23
- 1
I was running into some weird behavior in a game (Unity/PhysX), and it got me to wondering whether the behavior was reasonably accurate, or whether it was a bug in the physics simulation. The issue related to friction, in a potentially unrealistic case where Static and Dynamic friction are equal. I realize PhysX isn't an accurate simulation, but in this case, I was curious about whether it's doing the right thing, or if this is incorrect.
First, the "weird" thing I'm seeing. My setup is a world where in addition to gravity applying -Y force, there is also a constant -Z force ("Wind") pushing a box into a wall. The wall is frictionless, but the ground is not. The box ("player") can move in four directions by applying force. Here's a top-down view of this world:
If the "Wind" force is equal to the "Player's" movement force, then walking into the wind results in no movement at all, and the player remains held against the wall. If the "Wind" force is significantly less than the player's movement force, the player can overcome the Wind, and walk forward. But if the Player's movement force is just slightly higher than the Wind force, odd things happen. Let's say the Movement force is 105, and the Wind for is 100. In that case, the player won't actually move if they try to move into the wind. My assumption is that the small amount of additional force the player can exert compared to the wind is not enough to overcome the frictional force.
But here's the weird part. If I start by making the player slide left/right, and only then do I try to move into the wind, I can make some forward progress. The image above shows this in action. I'm always applying the same forward force when trying to move forward. But while moving left/right, I move forward more easily than trying to move forward from a dead stop. This would make sense to me if Static and Dynamic friction were different, but in this case I have them set to be identical.
The specific behavior is that while the player is moving even a little but left/right, he can move forward. As soon as he stops sliding left/right, he is no longer able to make any more forward progress.
I was trying to reason through why this might be reasonable. My thought was that friction can only exert so much total force, and so by moving left/right, it somehow lowers the amount of frictional force that can be applied against my forward movement. Does that make sense? Or is this simulation behavior just wrong?
First, the "weird" thing I'm seeing. My setup is a world where in addition to gravity applying -Y force, there is also a constant -Z force ("Wind") pushing a box into a wall. The wall is frictionless, but the ground is not. The box ("player") can move in four directions by applying force. Here's a top-down view of this world:
If the "Wind" force is equal to the "Player's" movement force, then walking into the wind results in no movement at all, and the player remains held against the wall. If the "Wind" force is significantly less than the player's movement force, the player can overcome the Wind, and walk forward. But if the Player's movement force is just slightly higher than the Wind force, odd things happen. Let's say the Movement force is 105, and the Wind for is 100. In that case, the player won't actually move if they try to move into the wind. My assumption is that the small amount of additional force the player can exert compared to the wind is not enough to overcome the frictional force.
But here's the weird part. If I start by making the player slide left/right, and only then do I try to move into the wind, I can make some forward progress. The image above shows this in action. I'm always applying the same forward force when trying to move forward. But while moving left/right, I move forward more easily than trying to move forward from a dead stop. This would make sense to me if Static and Dynamic friction were different, but in this case I have them set to be identical.
The specific behavior is that while the player is moving even a little but left/right, he can move forward. As soon as he stops sliding left/right, he is no longer able to make any more forward progress.
I was trying to reason through why this might be reasonable. My thought was that friction can only exert so much total force, and so by moving left/right, it somehow lowers the amount of frictional force that can be applied against my forward movement. Does that make sense? Or is this simulation behavior just wrong?