FConstraintInstance depracated members

I’m moving my project to 4.13 and have problem with some of FConstraintInstance members:
bSwingLimitSoft,bTwistLimitSoft,SwingLimitStiffness,SwingLimitDamping,TwistLimitStiffness,TwistLimitDamping are all depracated and don’t know what I should use instead. For most properties there are now setter functions, but not for these

They are avilable in Blueprint so I assume there is a way to set them in CPP. Should I just use _DEPRECATED version?

I’m going through the same process. You can get to them via the ProfileInstance member of FConstraintInstance, but I agree there really need to be some more getters and setters. Also I have a feeling there may be a bug with enabling drives programmatically, just looking into it now.

ProfileInstance returns an FConstraintProfileProperties instance.

Most of what you are looking for has been moved into another class, and much of it is vastly improved imho.

Specifically, the values you’re looking for, now live in:

FConstraintInstance Constraint;
FConstraintProfileProperties ConstraintProperties = Constraint.ProfileInstance; // Get the ProfileInstance
ConstraintProperties.LinearLimit.Limit = 1.f; // Some float value
ConstraintProperties.LinearLimit.bSoftConstraint = 1; // Soft Limit Constraint, 1 is true, 0 is false.
ConstraintProperties.LinearLimit.Stiffness = 1.f; // Linear Stiffness
ConstraintProperties.LinearLimit.Damping = 1.f; // Linear Damping

ConstraintProperties.ConeLimit.bSoftConstraint = 1; // Swings are now in CONE!
ConstraintProperties.TwistLimit.bSoftConstraint = 1; // Twist is in it's own property.
ConstraintProperties.ConeLimit.Stiffness = 1.f; // Your Swing Stiffness value.
ConstraintProperties.ConeLimit.Damping = 1.f; // Your Swing Damping value.
ConstraintProperties.TwistLimit.Stiffness = 1.f; // Your Twist Stiffness value.
ConstraintProperties.TwistLimit.Damping = 1.f; //Your Twist Damping value.

// Reapply the Properties back to the Constraint
Constraint.ProfileInstance = ConstraintProperties;

If you’ve done any of this using Rama’s static SetLinearLimits or SetAngularLimits functions then both will need updating to the 4.13 approach.
Swing is now under ConeLimit - which makes a lot of sense, as the swing would be within a conical movement.

I prefer the 4.13 notation, as you want to change a Linear property? Then it’s in the LinearLimit element. Want to change Swing? OK, so that’s under Cone, but at least it’s in the same place!

Good luck and hope that helps :slight_smile:

Thanks for this great post. If one is wondering: To use FConstraintInstance:

#include "PhysicsEngine/ConstraintInstance.h"

And e.g. to limit the motion in z axis it is the same as in Ramas description:

ConstraintProperties.LinearLimit.ZMotion = ELinearConstraintMotion::LCM_Locked;