How to setup only Z Axis allowed Constraints in C++

Screenshot 2022-06-15 210702

So I want these constraints applied to an actor by code, but there is not an option in EDOFMode to constraint all axis except Z.

GetOwner()->FindComponentByClass()->SetConstraintMode(EDOFMode::YZPlane);

And I don’t know how to set up a CustomPlane which is an option.

So, any help would be highly appreciated :slight_smile:

Cheers.!

UPrimitiveComponent* Primitive = Cast<UPrimitiveComponent>(YourComponentHere);

FBodyInstance* BodyInstance = Primitive->GetBodyInstance();

BodyInstance->bLockXTranslation = true;
BodyInstance->bLockYTranslation = true;
BodyInstance->SetDOFLock(EDOFMode::SixDOF);
1 Like

Got no words. Thank you very very much! :heart: