Overview
Physics Constraint Components operate just like Physics Constraints Actors, except they are used in Blueprints or can be created in C++. Given the flexibility of Blueprints and the power of C++, you can constrain just about any Physics Body in your project using Physics Constraint Components.
This document will cover Physics Constraint Component basic creation in a Blueprint.
This document assumes that the user has some knowledge of Blueprints and the Blueprint Editor.
Usage
-
Create the Components that will be used to constrain. For this demonstration, two StaticMesh Components referencing the StaticMesh
Shape_Cube
will be used.You will need to position the Components that you want to be constrained. For this guide, these two cubes are used.
-
Enable Simulate Physics for the lower of the two StaticMesh Components.
-
Click Add Component to find Physics Constraint.
-
Position the Physics Constraint Component where you wish the joint of the constraint to be.
-
You must manually type in the names of the StaticMesh Components you wish to constrain in the Details panel of the Physics Constraint Component. Type in the component name you wish to constrain in the Component Name 1 of the Component Name property.
-
Type in the component name you wish to constrain in the Component Name 2 of the Component Name property.
-
Select the Physics Constraint component and move its location to the bottom of the StableMesh component. This will place the anchor point at the bottom of the cube.
Want to know what all the properties on a Physics Constraint Component affect? See the %making-interactive-experiences/Physics/physics-constraints/ConstraintsReference:title% for specific details.
-
Rotate the Physics Constraint Component as necessary to account for Linear and Angular Limits.
-
Place the Blueprint Actor in a level and position it where you need it.
-
Select Blueprint Actor and go to the Details panel. Select the ConstrainedMesh component in the hierarchy and move it as seen in the picture. In this example, the location was set to X = -300 and Z = 100. This will allow the ConstrainedMesh to swing once you press Simulate.
-
Test by using Simulate in Editor or Play in Editor.