How would I make a Motor6D point somewhere?

For hours i’ve been trying to figure out how to make the RightShoulder Motor6D point at the mouse without any success.

Anyone knows how to do that?

Here’s the line of code I currently have:

Character.RightUpperArm.RightShoulder.C0=cf(WeaponsVariables.RightArmC0.p,WeaponsVariables.RightArmC0.p+(Mouse.Hit.p-Character.RightUpperArm.Position).unit)*angles(math.pi/2,0,0)

When I spawn and I don’t move, it works fine but if I rotate or move, it doesn’t work correctly anymore.

2 Likes

I believe your problem lies here.
(Mouse.Hit.p-Character.RightUpperArm.Position).unit
CFrames deal in local coordinates, you will need to convert this expression into a direction that is relative to the character rather than to the world.

1 Like

Thanks, I have difficulties converting though, I don’t really understand how Vector3:toObjectSpace(Vector3) works.

Solution found in this tweet.

8 Likes

aaaaaaaaaaaa sorry for necroposting but I’m currently facing the same problem, but on an R6 rig. I’ve been spending hours trying to edit the code above to no avail.

Does anyone happen to have a snippet of code to do this for shoulder joints on an R6 body?

Works relatively the same way. The joints are located in the Torso and it’s called Right Shoulder. What is the current code you have?

Currently I’ve just replaced the joint names / parts appropriately from the r15 script posted above

If for some reason you can not access the tweet, the link is here.

1 Like