How to get Character's arm to look at Point using its joints

I am currently trying to get the arm of an R15 dummy to look at a certain point in the workspace. I am trying to do this using the Motor6D joints as opposed to changing the cframe of each part directly and thats where Im running into issues. My code works in some cases but in others, it just looks completely weird.

Here is a video of what is going wrong.

Another issue I have noticed is that in the cases where the arm does move correctly, the arm is not lining up properly with the red brick. Instead, half of the brick is extending beyond the side of the arm as you can see in this picture. I want the center of the arm to point to the center of the brick
image

Does anyone know how to properly point the arm of you character correctly using the Motor6Ds?

Here is my current code

objectSpaceTarget = self.Joint1.Part0.CFrame:ToObjectSpace(CFrame.new(targetPosition))
self.Joint1.C0 = CFrame.new(self.Joint1.C0.p, objectSpaceTarget.p) *CFrame.Angles(math.pi/2, 0, 0)
1 Like

Iā€™d recommend you look into some inverse kinematics for some of this stuff. Also the stuff looking kinda weird in certain situations is rather hard to avoid.

1 Like

Hi Iā€™m soon finished getting it to work, just checking is this is how you want it to look if the part is behind:
robloxapp-20200703-0739232.wmv (192.9 KB)

1 Like

Yea that looks just right. Thanks!

Ok ill finish it up and send you a place file was just waiting on your response