Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Weldind a part to RightHand with a Motor6D?

sword = workspace.Sword
game.Players.PlayerAdded:Connect(function(plr)
	plr = game.Workspace:WaitForChild(plr.Name)
	local cSword = sword:Clone()
	cSword.Parent = game.Workspace[plr.Name]
	cSword.Position = plr.RightHand.Position
	local swordPartWeld = Instance.new("Motor6D")
	swordPartWeld.Parent = cSword.Welds
	swordPartWeld.Part0 = cSword
	swordPartWeld.Part1 = cSword.Part
	swordPartWeld.C0 = cSword.CFrame
	swordPartWeld.C1 = cSword.Part.CFrame
	local handPartWeld = Instance.new("Motor6D")
	swordPartWeld.Parent = cSword.Welds
	swordPartWeld.Part0 = plr.RightHand
	swordPartWeld.Part1 = cSword
	swordPartWeld.C0 = plr.RightHand.CFrame:Inverse()
	swordPartWeld.C1 = cSword.CFrame:Inverse()
end)

I have a like a Sword that is made of 2 parts. The first part which I would call it the Handle but the name of it is "Sword" and then inside Sword there's another part called "Part".

So I'm trying to do a Motor6D to weld it to the hand and then be able to animate with it. And my problem is that I don't know a lot about Motor6D.

Could anyone explain me the propeties or how can they work, please?

1 answer

✓ Accepted answer

Motor6D's have several properties. Its properties are much like Weld's properties it has a Part0, Part1, C0, C1 and so on so forth also it has MaxVelocity. So you can use the C0 and C1 properties and make it go through all axis by using for loops, if desired.

You can manipulate C0 and C1 also, but because these usually have translations, it can be more difficult to work out the values you need if what you’re doing is a simple rotation or translation. When parent Part A is connected to child Part B by a Motor6D, The orientation of Part B ends up being the orientation of Part A * C0 * Transform * C1:inverse(). Normally, Transform is the identity CFrame unless an animation is manipulating the joint, in which case the Transform value comes from the keyframe CFrame of the animation (or an interpolated value between 2 keyframes’ CFrames)

4 comments

0

I dont undersand what C0 and C1 are

0

C0 is the position aspect of the orientation between two parts in a weld.

0

and C1?

0

C1 is the same, but for the other part...like Part0 has the C0 and Part1 has the C1...you're giving them directions on how and where to interact basically

This discussion is preserved as it was. New answers, comments, and votes are closed.