How would you instantly set the rotation of a component bound to a physics constraint at any given time?

Hi,

I have 2 physics-enabled capsules connected through a physics constraint. Everything works as intended, where a second capsule rotates around the first. But I would occasionally like to set the rotation of Capsule 2 immediately, in a teleported, non-physics way.

My line of thinking for the solution is something like:

  • Disable physics constraint
  • Set rotation of capsule
  • Enable physics constraint

The only real problem is the rotation of Capsule 2 is driven by the physics constraint’s angular target orientation. Plus, rotating with the physics constraint rotates around the constraint component (which is what I want), whereas directly setting Capsule 2’s rotation would rotate it around its own pivot point. I’m using Unreal’s capsule collisions here, not meshes, so I can’t change the pivot point in a 3D software.

So the problem with my “solution” is 1) Capsule 2 would rotate around the wrong point (its own center) and 2) Re-enabling the physics constraint with the same angular orientation offset but a new component rotation would probably give me undesired results. That second issue could probably be figured out with some math, but issue 1 leaves me completely stuck.

I think there’s a solution here but I’m struggling to find it. Any help would be greatly appreciated!

I guess to expand on my question, would there possibly be a way to set the rotation of Capsule 2 instantly by using the physics constraints angular target orientation, including having the angular velocity be 0 in the next frame? Seems unlikely since I believe it’s using spring forces, but hopefully I’m wrong and there’s some kinda crazy math for it.