Orientating physics hands relative to camera orientation

I’m making a set of physics arms that are comprised of four parts: the shoulder, the brachium (upper arm), the forearm and the hand. When you are not moving or hold down either LMB or RMB the hands are positioned in front of the player like so:

However, when the player looks upwards, the hands don’t extend properly and usually go inside the player’s head:

This is a pretty big issue because I want to have scenarios where the player can reach up above them and interact with raised objects. This also happens if the camera is facing forwards which is even worse because you can’t grab objects in front of you unless you stand above them.
Also, it just looks plain ugly.

I am using the BodyGyro to orientate the hands and this is what I am currently using:

LeftTarg.CFrame = cam.CFrame * CFrame.new(-0.75, -0.3, -3.75) * CFrame.Angles(math.rad(-90), 0, 0)
LeftHandAlignment.CFrame 	= LeftTarg.CFrame

LeftTarg is an invisible part that floats in front of the character and is used for the AlignPosition that moves the hands.
LeftHandAlignment is the BodyGyro inside the hands and is set to LeftTarg's CFrame.
cam is the current camera.

I’m not sure if bodygyro is the correct way to solve this problem but I have tried using alignorientation to no success. All I want is for the hands to always face the way they face in the first image even when you are looking upwards.

Does anyone have any ideas as to how I can keep the hands behaving the way they do in the first image in all situations?
Thanks in advance.

1 Like

think you need more math.
what i read is that when you look straight forward the hands are -0.75 away, but when you look up only -0.3
what you want when looking up is that the hands are 0.75 up and 0.3 away

Actually, the third number is the distance from the camera. I can’t remember why but multiplying CFrame.new(0, 0, -1) by the cameras CFrame would return a CFrame 1 stud in front of the camera. I figured since the camera would be aiming upwards, the end result would be 3.75 studs above the players head and this is the case usually, but when I enable the body gyro it prevents the hands extending that far because they are rotated in such a way that the hands can’t move any further

To be clearer, the 0.75 is left/right, 0.3 is down and 3.75 is forwards. In this case looking straight up would mean 0.3 is slightly in front and 3.75 is upwards. It’s all relative to the camera’s CFrame.