Changing the Point of Rotation of a Motor6D

What do I want to achieve?
I’ve welded together a model with Motor6Ds in order to animate it with a dummy. I want to change the point that some of these parts rotate around, (like how an arm on a dummy rotates around the shoulder.)

Here is the simple script I’m using for welding:

local function weld(part0, part1, weldType, offset)
  offset = offset or CFrame.new()
  
  local weld = Instance.new(weldType or "Weld")
  weld.Part0 = part0
  weld.Part1 = part1
  weld.C0 = part0.CFrame:Inverse() * offset * part1.CFrame
  weld.Parent = part0
  
  return weld
end

I’m not sure if I should be changing the C1 as well, or what. Any help is appreciated, thank you for your time.

1 Like

Yes, you would need to change the C1, if the arm is Part1.

This function looks like “offset” means “offset the whole part”. You could change the meaning to be “offset of the weld” (keeping the part where it is) like this:

local function weld(part0, part1, weldType, weldOffset)
  weldOffset = weldOffset or CFrame.new()
  
  local weld = Instance.new(weldType or "Weld")
  weld.Part0 = part0
  weld.Part1 = part1
  weld.C0 = part0.CFrame:Inverse() * part1.CFrame * weldOffset
  weld.C1 = weldOffset
  weld.Parent = part0
  
  return weld
end
2 Likes

I appreciate the help, but using this has no different effect for me. The part still rotates around its center. The end goal of this is to make a bow that (funnily enough) bows as it’s drawn through animations and segmented limbs. As a result the part 0s and part 1s are the segments of the bow’s limbs.If you need additional information, let me know.

How did you call the function? Did you provide an offset?

Oh. Sorry about that. I didn’t. I see now that the script works. I’m not very accustomed to math with CFrames, would you mind letting me know how to find my desired offset for each part? I understand if not, I’m marking you as the solution anyway. Thank you for your help :slight_smile:

It would just be relative to Part1

So image this setup, where the second part is stacked onto the first:

+---+
|   |  <--- Part1, two studs tall
|   |
+-X-+  <--- Desired weld position X
|   |
|   |  <--- Part0, three studs tall
|   |
+---+

The offset you pass to the function would just be Vector3.new(0, -1, 0) – i.e. “starting at the center of Part1, move one stud downwards”.

3 Likes