Setting up dynamic physics constraint attributes in 4.14

How does one go about setting the advanced linear properties of a dynamic physics constraint in C++? I saw one of Rama’s old guides here, but it appears to be a little bit out of date. Now, many of the attributes FConstraintInstance has have been appended with the _DEPRECATED tag(i.e. bLinearLimitSoft_DEPRECATED, LinearLimitStiffness_DEPRECATED) . I can’t find any information about what they’ve been replaced with, though.

I tried using them anyway, but the values don’t seem to make it into the dynamic physics constraint component I am creating at runtime. I dug through the code a bit on how they get used, and I can tell they are still referenced, so maybe I need to call an update function after setting up that data?

If anybody can tell me if I’ve missed something obvious or explain how to get the constraint set up properly, that would be great. Thanks!

Okay, I figured it out. I did not look closely enough at how the _DEPRECATED fields are being used now. They are passed into another structure, ProfileInstance, which contains all of the deprecated fields. Interestingly, I don’t see that field on the API reference for FConstraintInstance, so I’m not sure if I’m setting it the correct way. However, when I set up the values this way, it does pass through to my generated constraint!

A specific example:

UPhysicsConstraintComponent* constraint = NewObject<UPhysicsConstraintComponent>(parent);

	FConstraintInstance constraintInstance;

	constraintInstance.SetLinearXLimit(ELinearConstraintMotion::LCM_Limited, length);
	constraintInstance.SetLinearYLimit(ELinearConstraintMotion::LCM_Limited, length);
	constraintInstance.SetLinearZLimit(ELinearConstraintMotion::LCM_Limited, length);

	constraintInstance.ProfileInstance.LinearLimit.bSoftConstraint = true;
	constraintInstance.ProfileInstance.LinearLimit.Stiffness = 1000.f;
	constraintInstance.ProfileInstance.LinearLimit.Damping = .5f;

	constraint->ConstraintInstance = constraintInstance;