My English not very well, i’ll try to describe clearly:
(1) I use C++ to initialize Componen like below: It works well.
phyConstCmp->SetWorldLocation(middlePos);
FString meshCmpName = this->GetComponentByClass(UStaticMeshComponent::StaticClass())->GetName();
FConstrainComponentPropName tmp;
tmp.ComponentName = FName(*meshCmpName);
if (!meshCmpName.IsEmpty())
{
phyConstCmp->ComponentName1 = tmp;
}
if (!targetActor)
{
return;
}
phyConstCmp->ConstraintActor2 = targetActor;
phyConstCmp->SetLinearXLimit(LCM_Limited, 1.f);
phyConstCmp->SetLinearYLimit(LCM_Limited, 1.f);
phyConstCmp->SetLinearZLimit(LCM_Free, 0.f);
phyConstCmp->SetAngularSwing2Limit(ACM_Limited, 45.f);
phyConstCmp->SetAngularSwing1Limit(ACM_Locked, 0.f);
phyConstCmp->SetAngularTwistLimit(ACM_Locked, 0.f);
phyConstCmp->InitComponentConstraint();
isInitPhyCmp = true;
(2) Then , I want to break the Constraints , i used like this. But it is not break, is there something that i did not do?
void AMyTest::BreakConstraint()
{
phyConstCmp->BreakConstraint();
}
(3) I want to break or resume the Constraints by my control, so i use the code:, But it seem can not do work well ,What is the right method to build this use C++?,
void AMyTest::ResumeConstraint()
{
phyConstCmp->UpdateConstraintFrames();
}
Thank you !