Motor6D Rotation is different than what I'm trying to set it as

  1. What do you want to achieve? Keep it simple and clear!

I’m in the early stages of making a gun system, I’m trying to make this gun weld to the view model arms properly. It is supposed to look like this.

  1. What is the issue? Include screenshots / videos if possible!
    The Motor6D gets set to -0, 90, 90 instead of the intended value of 90, 90, 0

This is in the configuration module script for the gun.

config.offset = CFrame.new(Vector3.new(0.2, 1.3, 0)) * CFrame.Angles(math.rad(90), math.rad(90), 0)

This is in the client-side module script for the gun system.

local grip = Instance.new("Motor6D")
grip.Part0 = viewModel_arms:WaitForChild("RightArm")
grip.Part1 = viewModel_gun.PrimaryPart
grip.Parent = viewModel_arms
grip.C0 = config.offset

Any help is appreciated, I’ve been stuck on this for a while now.

I remember already trying these two methods, but they have the same issue.

config.offset = CFrame.new(Vector3.new(0.2, 1.3, 0), Vector3.new(math.rad(90), math.rad(90), 0))
config.offset = CFrame.new(Vector3.new(0.2, 1.3, 0), Vector3.new(0,0,0)) * CFrame.Angles(math.rad(90), math.rad(90),0)

I’m very tired right now, I apologize if I am missing anything, let me know if you need more details about anything and I will provide them.

1 Like

Instead of doing CFrame.Angles(math.rad(90), math.rad(90),0)
try doing

CFrame.Angles(0,math.rad(90), 0) * CFrame.Angles(math.rad(90),0,0)

I wouldn’t know how to explain it to you, I’m not sure myself how/if it works but it fixed it for me once.

I think that CFrame.Angles uses YXZ instead of XYZ but again, I’m not sure

1 Like

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