Download

How does "Set Constraint Mode" work?

I’m trying to have a static mesh blueprint with physics enabled constrain itself to a plane at runtime. However the “Set Constraint Mode” node will let me pick “custom” from the dropdown, but how do I set the custom plane in BP?

Thanks in advance.

I ended up using C++. Is there really no BP equivalent to this?



FBodyInstance* pBodyInstance = meshComponent->GetBodyInstance();
pBodyInstance->CustomDOFPlaneNormal = FVector(1.0f, 0.0f, 0.0f);


I have no idea what I’m going with C++. Can we put in a feature request to add this to blueprints? @Unreal

Nevermind. I was able to achieve what I needed thanks to an old post:

"So all you need to do to make this work is:

  • Attach a PhysicsConstraintComponent
  • Set Constraint Component 1 to be the name of the root component of your actor.
  • Leaving Constraint Component 2 empty will constrain the actor to the world
  • Lock/Free the particular axis set to get the plane you want. for example Free X,Y Lock Z will give you an actor that can move freely only on the xy plane and will not move up and down. Rotations work in revers Swing Angle 1 is Z, Swing Angle 2 is Y and Twist Angle is X. If XY is your 2d plane, then you want to set Swing Angle 1 to free, Swing Angle 2 and Twist to Locked."

Thanks to @kylawl

2 Likes

Good to know, @NotSoAccurateNo1 .