The arms don’t rotate correctly based off of the camera. If I don’t make x negative, the arms rotate in the opposite direction of the camera.
CODE:
local function getRotationFactor()
local x, y, z = workspace.CurrentCamera.CFrame:ToOrientation()
print(-x)
return -x
end
leftShoulder.C1 = originalLeftArmC1 * CFrame.Angles(getRotationFactor(), 0, 0)
rightShoulder.C1 = originalRightArmC1 * CFrame.Angles(getRotationFactor(), 0, 0)
The arms do rotate correctly on the X, but they also rotate on other axis.
Video:
I just need help with fixing the weird rotation bug. If you really need it I can post the whole script, however it’s 100+ lines and most of it has nothing to do with those 8 lines. Thanks!
Ok, so I have no idea what I’m doing. I’m completely lost and I can’t find my solution anywhere. I’ve been working at this for the past couple of days. Do you have anything else that might work?
Here is a snip, Obviously just replace the Waist with the arm, you’ll need two of these.
Replace TorsoLookVector to the arm lookVector.
Of course, put this in a heartbeat or something similar.
local Point = PlayerMouse.Hit.p
local HeadPosition = Head.CFrame.p
local Distance = (Head.CFrame.p - Point).magnitude
local Difference = Head.CFrame.Y - Point.Y
Waist.C0 = Waist.C0:lerp(WaistOriginC0 * CFrame.Angles(-(math.atan(Difference / Distance) * 1.2), (((HeadPosition - Point).Unit):Cross(TorsoLookVector)).Y * 1.2, 0), 1.2 / 2)
I messed around with the values and ended up with a result that kind of works but at the same time doesn’t. It goes up just fine but there are several issues:
-The left arm drifts from the right arm
-The arms get stuck when looking down
-When looking up the arms slowly tilt to the right
Here is my modified code:
Once those 3 issues are fixed it should be good. Thanks for your help by the way, you are a life saver. I don’t know what I would have done without you!