Pivot Torso Around Twisted Waist

  1. What do you want to achieve?
    I have an Animation that pivots the whole body for aiming a gun. Using the Waist Motor6D, I’m trying to get an effect that looks like this: Imgur
    Where the UpperTorso is inline with the LowerTorso until movement begins around the waist. Notice how the part is pivoting around the red line. That red line is basically always parallel to the HumanoidRootPart’s RightVector.

  2. What is the issue?
    Both of these attempts/issues I have made run correctly in a script:

Attempt 1:
The C0 of the waist is relative to the CFrame of the LowerTorso, so the effect I normally get is this:

This is bad, because the entire upper half is no longer looking straight, it gets cockeyed.
Code:

Player.Character.UpperTorso.Waist.C0 = CFrame.new(0,0.2,0)*CFrame.Angles(angle,0,0)

Attempt 2:
I tried to eyeball offset the new angle by like 22 degrees:

This is bad, because now his front is no longer angled, as shown:

Code:

local torsocf = CFrame.new(0,0.2,0)*CFrame.Angles(0,math.rad(22),0)
Player.Character.UpperTorso.Waist.C0 = torsocf*CFrame.Angles(angle,0,0)

Please let me know of any ideas. I would @Maximum_ADHD if I could.

Although it’s more hardcoded, I somehow managed to get this solution working:

waist.C0 = CFrame.new(0,0.2,0)
           *CFrame.Angles(0,RAD(40),0)   --Rotate waist so parallel to HRP
           *CFrame.Angles(angle,0,0)     --Pivot back backwards
           *CFrame.Angles(0,RAD(-40),0)  --Rotate waist so still parallel to HRP, but now angled

The 40 is the angle of the LowerTorso in the animation. The angle is the vertical looking angle.

I’d still like a better solution than this, but at least it works. Please respond if you have any alternative methods.