I have already this thread here that reports of an issue with physics constraint component here.
I am not sure if it’s fixed, but I do know is that when rotating an actor in the air, while the actor is constrained by a physics constraint component, I cannot seem to make the actor rotate without the actor, the physics constraint component, and another actor the physics constraint component is bound to go haywire if rotated too far.
My goal is to try and make the actor tilt slightly while still constrained in the air. Each of these actors are connected together to form a chain that bends ever so slightly, creating a curl. This curl is used as an arm extension that bends and picks up items.
GIF of the actors going haywire: GIF | Gfycat
https://giant.gfycat.com/WhimsicalMixedCrocodile.gif
Just tilting it makes the physics constraint component go haywire, so I am not sure what to do about it, other than to request for help.
Here are the codes:
BaseFrame.cpp (Relevant codes only)
void ABaseFrame::Swivel(float Value){
if ((this->Controller != nullptr) && (Value != 0.0f)){
for (auto Iterator = this->AngleFrameArray.CreateIterator(); Iterator; ++Iterator){
AAngleFrame* AngleFrame = *Iterator;
if (AngleFrame->CurrentSwivelAngle < AngleFrame->MaxSwivelAngle && AngleFrame->CurrentSwivelAngle > AngleFrame->MinSwivelAngle){
AngleFrame->CurrentSwivelAngle += Value;
}
LOG("Current Angle: " + FString::SanitizeFloat(AngleFrame->CurrentSwivelAngle));
}
}
}
void ABaseFrame::OnConstruction(const FTransform& Transform){
Super::OnConstruction(Transform);
//Minimum height is 100f on the +Z axis. Anything more than 100.0f will leave gaps in between each frame.
FVector FrameHeight(0.0f, 0.0f, 150.0f);
FActorSpawnParameters Params;
Params.Owner = this;
USceneComponent* Scene = this->GetRootComponent();
UPrimitiveComponent* Primitive = this->FrameCollider;
for (int32 i = 0; i < this->ConstraintNameArray.Num(); i++){
AAngleFrame* Frame = this->GetWorld()->SpawnActor<AAngleFrame>(AAngleFrame::StaticClass(), FrameHeight, this->GetActorRotation(), Params);
Frame->FrameCollider->AttachTo(Params.Owner->GetRootComponent());
Frame->SetNumberTag(i);
this->AngleFrameArray.Push(Frame);
UPhysicsConstraintComponent* Physics = this->PhysicsConstraintArray[i];
Physics->AttachTo(Scene, NAME_None, EAttachLocation::SnapToTarget);
Physics->SetConstrainedComponents(Primitive, NAME_None, Frame->FrameCollider, NAME_None);
Physics->SetAngularSwing1Limit(EAngularConstraintMotion::ACM_Locked, 0.0f);
Physics->SetAngularSwing2Limit(EAngularConstraintMotion::ACM_Locked, 0.0f);
Physics->SetAngularTwistLimit(EAngularConstraintMotion::ACM_Locked, 0.0f);
Params = {};
Params.Owner = Frame;
Scene = Frame->GetRootComponent();
Primitive = Frame->FrameCollider;
}
}
Let me know if you need more info, and I will be happy to provide you them.