Constraint Angular Velocity Drive

If I set Angular Velocity Drive for a PhysicsConstraintActor from the Editor all fine and dandy. I start playing and the Constraint Actor swings for a few seconds then stops.

However, if I do the same from C++ code, the actor does not stop swinging. What am I missing?

I also tried from Blueprints with “Set Angular Velocity Drive”, “Set Angular Velocity Target” and “Set Angular Drive Params”. Same thing, the actor does not stop swinging.

Editor settings:

Angular Velocity Drive - checked

Angular Velocity Target - 0,0,0

Angular Drive Force Limit - 1000.0

Angular Position Strength - 50.0 (editing disabled)

Angular Velocity Strength - 1.0

Angular Drive Mode - Twist and Swing

C++ code:

for (TActorIterator<APhysicsConstraintActor> AItr(this->GetWorld()); AItr; ++AItr)
	AItr->ConstraintComp->SetAngularVelocityDrive(true, true);
	AItr->ConstraintComp->SetAngularVelocityTarget(FVector(0.f, 0.f, 0.f));
	AItr->ConstraintComp->SetAngularDriveParams(50.0f, 1.0f, 1000.0f);
	AItr->ConstraintComp->ConstraintInstance.AngularDriveMode = EAngularDriveMode::TwistAndSwing;

	GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Yellow, "Params set for " + AItr->GetName());

Hi gmiha,

We’ll reply as soon as possible. Thanks for your patience.

Hello gmiha,

Hm, looks like a bug. Some options (like drive mode: SwingAndTwist or SLerp for angular drive) only used only for initialization. So, try after your initialization to recreate joint.


It is not the best way, because it requires some penalty time to reinitialize joint. But I think it is the only way to do that in current case (Which may be fixed in 4.6, I tested it on 4.5)

Also, if you want to break one body (pendulum case, etc.) look at Angular Breakable option.

Best regards,

Hi ,
Thanks a lot for your support, it works great after adding a call to InitializeComponent()!
Best regards,

Hey, im pretty sure im having the same issue but im doing it on blueprint so i can’t initialize the component again :frowning:

It’s works fine in the construction graph but not in the event graph…i guess the bug hasn’t been fixed :frowning:

In blueprint, call “Set Angular Velocity Drive” every frame, this will have the same effect as initializeComponent