How-To Apply a Physics Constraint Profile

Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

Below, you will find the steps for creating a simple graph to enable a Constraint Profile on a Skeletal Mesh Component in a Pawn.

Steps

  1. Open or create a Blueprint with a Skeletal Mesh Component.

    • If your Blueprint doesn't contain a Skeletal Mesh Component, add one using the Components Panel.

    addSkelMeshComp.png

  2. Adjust the Skeletal Mesh Component Collision settings.

    • The Collision Preset needs to be changed so that that Skeletal Mesh Component has Collision Enabled, and if a Pawn capsule (or other geometry) exists make sure that the collision settings are compatible. For example with a Pawn capsule make sure to ignore the Pawn collision:

      collisionSettings.png

      You'll notice that the Object Type is set to Pawn and that we're ignoring Pawns in our collision channels. This fixes the issue of the Skeletal Mesh trying to eject itself from the collision capsule. However, if you want the Skeletal Mesh to collide with other Pawns you'll need to adjust what Object Type your Skeletal Mesh is and then change how the Capsule interacts with that Object Type. See: Add a Custom Object Type to Your Project , for more information on creating Custom Collision Channels.

  3. Add a Physical Animation Component to your Blueprint using the Components Panel.

    addPhysAnimComp.png

  4. Add a Name Variable and call it Bone Name.

    variableName.png

  5. Compile so we can set the value of the Bone Name variable.

    compile.png

  6. Change Bone Name's Default Value to the desired target Bone, in this case spine_01.

    boneName.png

  7. Switch to the Event Graph.

  8. Locate or create the Event BeginPlay event node.

    eventBP.png

  9. Add a reference to your Skeletal Mesh Component

    addSKMPref.png

  10. Pull off the blue pin on your Skeletal Mesh Component and search for Set Constraint.

    createSetAll.png

  11. Add a Set Constraint Profile for All node.

    • Target is your Skeletal Mesh Component.

    • Profile Name is the name of the Constraint Profile that you created (or will create) in the Physics Asset Tool.

    • (optional) Default if Not Found if a bone doesn't exist in the Profile, it will keep its current settings.

    constraintProfNodeSettings.png

  12. Set All Bodies Below Simulate Physics Node connected to the Apply Physcial Animation Profile Below Node.

    • Target is your Skeletal Mesh Component.

    • In Bone Name will take the Bone Name variable as input.

    • New Simulate should be set to True.

    • Again, since we are using spine_01 as the target bone, Include Self should be checked.

  13. Final Graph:

    Copy Node Graph

    fullGraph.png

    Hidden Graph Information

    Variable Value Description
    Bone Name spacer.png spine_01 We use it in the Set All Bodies Below Simulate Physics to define what parts of the Skeletal Mesh are simulating.
    Component Description
    Skeletal Mesh Component The Skeletal Mesh Component that will be have the Constraint Profile applied to it. If you are inheriting from Character this will just be named Mesh.

Result

Now when you play your game, the Constraint Profile will take over. Depending on your settings, this could mean that your character falls apart, or has motors engaged to make their arms flail around.

result.png

This effect was achieved by setting the Linear Limits on the upper arm constraints to Free.

achievedBy.png