How-To Apply a Physics Constraint Profile

This how-to will show you how to apply a Physics Constraint Profile to a Skeletal Mesh Component using Blueprints.

Windows
MacOS
Linux
Prerequisite Topics

In order to understand and use the content on this page, make sure you are familiar with the following topics:

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 in our example 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 you can set the value of the Bone Name variable.

    compile.png

  6. Change Bone Name 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. 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 Editor.

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

    constraintProfNodeSettings.png

  11. Add a Set All Bodies Below Simulate Physics node connected to the Set Constraint Profile for All node.

    • Target is your Skeletal Mesh Component.

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

    • New Simulate should be enabled.

    • Since you are using spine_01 as the target bone, Include Self should be enabled.

  12. Final Graph:

    Copy Node Graph

    fullGraph.png

    Hidden Graph Information

    Variable

    Value

    Description

    Bone Name

    spine_01

    Used by the Set All Bodies Below Simulate Physics node to define what parts of the Skeletal Mesh are simulated.

    Component

    Description

    Skeletal Mesh Component

    The component that will be have the Constraint Profile applied to it. If working from an existing Blueprint that inherits from Character, it will 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

Additional Resources

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss