Closed cga-cmu closed 4 months ago
Box2D gets all these cases (static box on slope, cylinder (no 3D spheres in 2D) rolling down a fixed slope, and a cylinder rolling on a curved slope (a larger cylinder) right.
Thank you for the detailed report and repro, @cga-cmu ! We will investigate. Internal Tracking PX-5048.
There is an issue with the current release of Physx. The Contact Reporter only reports the normal force and does not report the friction force. Therefore, the force that it measures is
F = m g cos(\theta) \hat{n}
where \hat{n}
is the surface normal. Therefore, the reported force will be
F = m g [cos(\theta) sin(\theta), cos^2(\theta)]
.
For m=1.0Kg, this will be F = [4.24, 7.35]. Therefore, the reported value is correct.
I have heard that this issue will be fixed in the next release, and the API will report the friction forces.
It's as farbod-farshidian is pointing out. The impulses reported in contact reports are only the impulses applied along the contact normals. The next version of PhysX will provide an API to also extract the friction impulses. If then summed up, it will converge to the expected y=9.81 force (plus/minus 0.01 or so) in your example (once it settles down after the initial impact of the falling box).
@cga-cmu - we expect to release the update with the friction reporting by the end of the month.
Library and Version
PhysX-105.1-blast-5.0.4
Operating System
Ubuntu 22.04
Steps to Trigger Behavior
Code Snippet to Reproduce Behavior
Expected Behavior
Fx = 0 Fy = 9.81 (mass = 1)
Actual Behavior
Static forces are wrong. For a block not moving on a 30 degree slope with default PxMaterialFlags Fx = 4.2479 (should be zero) Fy = 7.3575 (should be g, which is set to 9.81, since mass = 1) The overall force magnitude is too big (sqrt(Fx^2 + Fy^2) > 9.81), so it can't be that the forces are reported in some rotated coordinate system. Various combinations of strong friction, improved patch friction, compliant contacts, and removing the 2D constraint (setRigidDynamicLockFlags) did not substantially change these numbers.
Contact forces are also wrong for the dynamic cases of a sphere rolling down a fixed slope or rolling on a curved slope (a larger sphere). However, the accelerations are correct. For the case where the accelerations change (a sphere rolling on a curved slope the contact forces are not simply a scaled version of the correct answer, so there is more than just a scaling factor error going on.