Skip to content

Ragdolls cannot have constraints: no C entry point produces TwoBodyConstraintSettings #5

Description

@jcant0n

JoltC_RagdollSettings_SetPartToParent takes a const JoltC_TwoBodyConstraintSettings*, and nothing in any JoltC header produces one. Grepping include/ finds the type exactly twice: the opaque typedef in common.h and this one parameter.

So NULL is the only value a C caller can pass, mToParent is never assigned, and every JoltC ragdoll is a collection of unconnected rigid bodies with zero constraints.

Why it matters now

JoltPhysics 5.6.0 adds Ragdoll::DriveToPoseUsingMotors and EMotorState::PositionAndVelocity. From C there is currently nothing for either to act on, so that part of the release cannot be exposed until this is closed.

Two consequences worth knowing

  • RagdollSettings::CreateRagdoll guards p.mToParent != nullptr before bodies[mSkeleton->GetJoint(joint_idx).mParentJointIndex], so the out-of-bounds read on an unresolved -1 parent index is currently unreachable. Closing this gap makes it live, and AddJoint3 deliberately leaves indices at -1.
  • RagdollSettings::GetConstraintIndexForBodyIndex indexes mBodyIndexToConstraintIndex, which is empty until CalculateBodyIndexToConstraintIndex() is called — and CreateRagdoll does not call it. DriveToPoseUsingMotors calls it internally, so "build that table first" is an undocumented precondition.

Found while writing JoltC/tests/test_skeleton_extra.c, which covers all 82 declared functions and reaches this one only through its null path.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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