CFrame.Angles and how

Hello,

I wanted to know if anybody could help me understand how and when to use “CFrame.Angles” assuming that’s what I want. I’m trying to rig a sword to my model. But whenever I try to adjust it’s CFrame, nothing happens.

Sword.Parent = game.Workspace
		Sword.Handle.CFrame = Character.RightHand.CFrame
		task.wait()
		Sword.Handle.CFrame = Sword.Handle.CFrame * CFrame.Angles(90,0,90)
		Joint.Parent = Character.RightHand
		Joint.Part0 = Character.RightHand
		Joint.Part1 = Sword.Handle

Can someone tell me how I’m supposed to do this?
Any and all help is greatly appreciated.

PS: the (90,0,90) was just a test since I figured it’d be obvious.

U should use math.rad() on the angles passed to CFrame.Angles().

CFrame.Angles(math.rad(90), 0, math.rad(90))
1 Like

I already tried that and it doesn’t affect the model

msix is correct when it comes to using radians vs degrees (CFrame.Angles accepts radians), but the root of the problem here lies with the joint that you’re using.

It doesn’t matter what you set the CFrame of the handle to, the joint will override it. What you need to do is set the C0 and C1 properties of the joint so that the sword’s handle offsets itself from the right hand.

Joint.C0 = CFrame.Angles(math.rad(90), 0, math.rad(90))

You’ll see that the sword’s handle goes inside of the right hand and spun around a little. If you want to offset it from the hand you need to apply more CFrame magic:

Joint.C0 = CFrame.new(0, 0, 1) * CFrame.Angles(math.rad(90), 0, math.rad(90))

The above code is just an example, you can fiddle around with it yourself.

1 Like

Trying this out right now, let you know how it goes

This worked flawlessly, I’ll have to remember it’s not the model that I have to change, it’s the joint/welds, thank you.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.