Physics constraint component behaves unexpectedly on rotated actors in scene

Using Unreal Engine 4.5 blueprint, I’ve created a dumpster physics prop with a left and right lid attached by a hinge. It has 3 static meshes (dumpster body, left lid, right lid), and 2 physics constraint components holding the lids onto the body with a hinge.

The prop works exactly as I’d expect when placed into the scene with no actor rotation. I can interact with it and the lids flap about within the constrained limits. But if I place an instance of the actor into the scene with arbitrary rotation, the physics constraint seems to initialize incorrectly, and the hinges work but in a broken fashion.

At a guess I’d say the physics constraint code isn’t compensating for the actor’s world transform. When I select the actor, I can see the blue + red boxes that the physics component is drawing are AABBs, perhaps this is related. For the record, I tried translating each lid to the far left + far right of the dumpster body so that no AABBs or static meshes could overlap, but the issue persisted.

Here’s a video running through the blueprint setup, demonstrating the blueprint works as expected when in the scene with no rotation, but messes up after being rotated:

Hi sds-,

I tested this in our latest internal build and it’s now working correctly. You’ll see this fixed in a future update.

In the meantime, I believe I found a workaround for you. You will need to set everything up in the Construction Script of the blueprint by setting the Swing Limit and Local Offset based on the direction the dumpster is placed.

  • Back in your Physics Constraints, set the Angular Swing 2Motion values back to their defaults and set it to Locked.

  • Make sure the Disable Collision option is unchecked (all objects should have their own collision).

  • In the Construction Script, set up the blueprint as I have pictured below.

  • You can change the value I have set as 180 as needed, it adjusts the amount you want the lids to swing.

I was hoping to duplicate your setup in blueprints exactly but there is a rotation difference in the core of the engine. The Angular Swing Limit node is looking for the standard 0 to 360 degree rotation. Our engine uses a 0 to 180/-180 to 0 rotation for assets.

If you have issues implementing this or have any other questions, please feel free to ask.

Cheers,

TJ

Thanks for the detailed reply and the workaround TJ, very much appreciated! I’m happy to wait for the fix to propagate through in the next engine update, though I may go hunting through UE4 mainline in GitHub for the specific fix and patch our engine if it’s a simple change to PhysicsConstraintComponent.cpp/h. Cheers!

I found the specific commit in the UE4 master branch:
https://github.com/EpicGames/UnrealEngine/commit/7e4fd0faef1cdf2a6885730a900127ad05cd93ab
I integrated this into our local engine code and it works great now!

I’ve found another issue related to placing physics-constrained actors in sub-levels, however I’ll file a new report for this. Thanks again!

I found the new report you posted. I’ll look into it as soon as I can.

Hi, I believe this bug came back in the latest release.
I’m using the 4.14.1 and experiencing the exact same issue. Physics react perfectly in BP simulation and once place in scene, swinging component behave heretically.

Hi thebenjiman,

I just tested this with a similar setup to what OP showed above in 4.14.3 and it is working as expected on my end. Maybe it’s confined to your project?

Could you provide updated repro steps, screenshots, and/or a small test project?

I am also having this same issue in 4.15.0. A regression may have occurred. I tried dragging a new instance of my Blueprint actor into my Persistent Level instead of the SubLevel that my Actors are present in, but the issue persists: the Physics Constraint Bounding Box is Axis-Aligned, ignoring the World Space rotation of the parent base component.

Hi mindridellc,

I attempted to reproduce this in 4.15, but I couldn’t get your results. Could you supply a small test project that has the issue?

I’m still getting this issue in 4.26.2