Skip to content

Constraint project function seems not working on Linearlimit with LOCKED flag. #150

@Oikura588

Description

@Oikura588

In my UE4 project, when performing Ragdoll simulation, I occasionally encountered a situation where the leaf nodes rigid bodies(such as hands or feet) got stuck in the scene and couldn't move. In this case, the LinearLimit constraint set between the rigid body and their parent with "Locked" status failed to solve correctly. This further led to the constraint applying greater and greater forces, causing the entire Ragdoll to start twitching and exploding.

After reviewing the docs and code, I found that the PxConstraintFlag::ePROJECTION flag should be used to handle this situation. However, I noticed that after the function
(*constraint.project)(constraint.constantBlock, body0ToWorld, body1ToWorld, projectToBody0)
calculated that targetPose which the leaf nodes should be pulled to the parent's transform, BUT then in the
static void constrainMotion , the logic: if (lockFlags & PxRigidDynamicLockFlag::eLOCK_LINEAR_X) deltaPos.x = 0.f; resulting in the new transform calculated by the project not work. Like:

deltaPos = targetPose - currentPose;

if(lock) deltaPose = 0;

currentPose += deltaPose;

Is this a bug? Because this logic is not outside the constraint's project function and cannot be resolved by creating a custom constraint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions