Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect default for eDRIVE_LIMITS_ARE_FORCES #227

Open
shaneasd opened this issue Dec 7, 2023 · 2 comments
Open

Incorrect default for eDRIVE_LIMITS_ARE_FORCES #227

shaneasd opened this issue Dec 7, 2023 · 2 comments
Assignees

Comments

@shaneasd
Copy link

shaneasd commented Dec 7, 2023

Library and Version

PhysX 5.2.1
PhysX 4.1.2

NOT: PhysX 3.3.4

Operating System

Windows 10

Steps to Trigger Behavior

  1. Use PxD6JointCreate to construct a new D6 joint
  2. Call getConstraintFlags on the newly constructed joint and examine the result

Code Snippet to Reproduce Behavior

        auto j = PxD6JointCreate(*m_physics, actor0, localFrame0, actor1, localFrame1);
        std::cout << (unsigned int)(j->getConstraintFlags()) << "\n";

Expected Behavior

In early versions of PhysX 3, the forcelimit value on joints was actually an impulse limit.

In PhysX 3.3 this issue was rectified. A new flag was added (eDRIVE_LIMITS_ARE_FORCES ) described as
"Joint drive force limits are actual force limits rather than impulse limits. Set the flag PxConstraintFlag::eDRIVE_LIMITS_ARE_FORCES to false to support legacy behavior"
in order to get the correct behavior the flag had to be true by default and indeed up to PhysX 3.3.4 this was the case.

Actual Behavior

Somewhere between PhysX 3.3.4 and PhysX 4.1.2 the default flags for a newly constructed joint seem to have changed. Calling getConstraintFlags now returns an enum with no flags set, including eDRIVE_LIMITS_ARE_FORCES . I note that the bit flag for eDRIVE_LIMITS_ARE_FORCES also changed (from 1<<6 to 1<<5 IIRC) in PhysX 4 but I don't think that should make a functional difference to this problem.

This issue persists into PhysX 5.

The problems this causes are:

  • Attempting to upgrade code from PhysX 3 to PhysX 4+ involves a silent change to the functional strength of these joints (depending on the simulation this is likely to be at least a 60 fold difference). This isn't described in the upgrade steps and is, in my experience, difficult to diagnose.
  • New code written targeting PhysX 5 will have the same problem which existed in PhysX 3.2 which is that when you specify forcelimit what you get is an impulse limit.
@preist-nvidia
Copy link
Collaborator

Thank you for the report @shaneasd! We'll have a look. Internal tracking: PX-4664

@msauter-nvidia
Copy link

Hi shaneasd,
Your observation is correct and the behavior changed in 3.4. However, we currently do not plan to change this back since it would impact all users of 3.4 and upwards. The documentation of PxD6JointDrive::forceLimit specifies that it depends on eDRIVE_LIMITS_ARE_FORCES how the value is interpreted. We can at least adjust the 3.4 migration guide though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants