How can you make an offset to a motor6d

I am trying to make a handle weld to the right arm but offsetted 1 stud downwards. I also want the handle rotated 90 degrees but that puts the handle in the sky so I removed it for now
Code:

RightGrip.C0 = RightArm.CFrame:ToObjectSpace(CFrame.new(0,-1,0))

I don’t have any idea on how to do this. I’ve been searching for answers for about 4 hours now. I don’t know what I’m doing with my life at this point.

2 Likes

You can use attachment inside the main part. In the position attribute set the offset. And In the motor6D object, set the CFrame.new(attachment .WorldPosition) as c0.

1 Like

Well now the handle is in the sky. Wouldn’t that be the same as

C0 = CFrame.new(Vector3.new(0,0,0))

By the part0’s rotation changes a lot

You can use WeldConstraint like this:
They dont need c0.

local part1 = part1
local part2 = part2
local offset = CFrame.new(1,0,0)
local weld = Instance.new(“WeldConstraint”, part1)
part2.CFrame = part1.CFrame * offset
weld.Part0 = part1
weld.Part1 = part2

1 Like

I need animations though. Its for a gun handle. If I tell anyone its for an fps engine people get to scared and don’t answer the question.

Facing right:

Facing left

I swear couldnt you use toolgrip or something

It is not a tool it is a model. Im making a character follow your camera and have animations and stuff. Not as simple.

if u know the cframe of the arm u could make the cframe relative to the arms cframe then just offset it. if say the arms cframe is A and the guns is G what we basically got is
G*someMatrixTransformation(M)=A

so we first move it to the side so we get like
M=A/G
and since we can’t divide matrices we gotta get the inverse then multiply it since it’s practically the same leaving us with that the matrix transformation is A*inverse(G)

then we multiply that transformation matrix by the guns cframe. from here we can do pretty much anything now, perhaps even combining the transformation matrix with a translation matrix up to make it pivot like you suggested, maybe like

gun.CFrame = CFrame.new(0,1,0) * (arm.CFrame * gun.CFrame:inverse())
1 Like

I think the c0 is the offset if the part0 is the handle.

I feel like should work. But it is doing the exact same thing. Am I doing something completely wrong here??

Handle.CFrame = CFrame.new(0,1,0) * (RightArm.CFrame * Handle.CFrame:inverse())


When I face other directions and re equip the gun it moves.

local offset = CFrame.new(0,0.1,0)
Weld.C0.CFrame = (RightArm.CFrame) * offset

do you set the motor6ds c0/c1?

1 Like

I set the gun handle’s cframe. If I were to set the c0 or c1 how would I do it.

If I use c0 the gun is out of view.
If I use c1 the gun does the same thing.

robloxapp-20210707-2027497.wmv (3.7 MB)


robloxapp-20210707-2027080.wmv (1.8 MB)
Here I change the offset

This is completely different. I think. Because whenever I move my camera it changes. It is not a normal tool weld.

If the camera change the weld too.

Its when I re equipt the gun and look elsewhere

In my system there is a client model and a server model. The client one is the one we are talking about. The server model is the one in the tool.

Dont use handle.CFrame, use C0.

1 Like


This is what happens.
Its not as simple as “use c0” which everyone is telling me. Im starting to think I will never get this fixed. Which is probably the case and I will have to just quit this. I have been here all day looking for answers and have found 0.