How Can i Rotate Welded Part?

Alright so Im Having this Problem for a Long Time

Basically, I’m Making a Battleship Gun, The Gun consists of 2 Parts
A Canon and an inner Part (Both of Them are welded Together using a WeldConstraint)
and The Canon Part Rotates, But when it rotates, it Rotates itself, and The inner Part with
So is There is a Simple Way To Rotate The Canon Without Effecting The inner Part?

Basically, it is Going Like This:

were it is supposed To Go Like This:

1 Like

The only one who has encountered Almost The Exact Problem as me was in this Post:

I’m going to assume since you provided no code that you’re rotating a part orientation, rotate the actual weld object’s C0 or C1 using CFrame.Angles instead.

1 Like

Firstly, I’m Using a WeldConstraint,
Secondly, I’m Already Rotating The Part Using CFrame.Angles

Why not using Motor6Ds instead of WeldConstraints?

You’re gonna have to use a normal Weld so you can adjust the C1 property to get the desired affect, WeldConstraints aren’t that good for applications where one part can rotate. Or you could use a Motor and utilize its properties related to Angles

i Tried, But Got The Same exact Problem

Provide the code then. By using Motor6Ds and changing the C0 and C1 CFrame its a good approach, make sure that the base part of the turret has enough Mass too.

Would be better if you show your code, otherwise we’re just “guessing”

local ConnectionUp = nil
local ConnectionDown = nil

game.ReplicatedStorage:WaitForChild("RotateUp").OnServerEvent:Connect(function(player)
	local Rotators = CollectionService:GetTagged("Rotators")
	ConnectionUp = game:GetService("RunService").Heartbeat:Connect(function()
		for _,Rotator:Part in pairs(Rotators) do
			local Weld = Rotator:FindFirstChildOfClass("Motor6D")
			Weld.C1 = Rotator.CFrame * CFrame.Angles(math.rad(0.3),0,0)
		end
	end)
end)

game.ReplicatedStorage:WaitForChild("RotateDown").OnServerEvent:Connect(function(player)
	local Rotators = CollectionService:GetTagged("Rotators")
	ConnectionDown = game:GetService("RunService").Heartbeat:Connect(function()
		for _,Rotator:Part in pairs(Rotators) do
			local Weld = Rotator:FindFirstChildOfClass("Motor6D")
			Weld.C1 = Rotator.CFrame * CFrame.Angles(math.rad(-0.3),0,0)
		end
	end)
end)

game.ReplicatedStorage:WaitForChild("DisableUp").OnServerEvent:Connect(function(player)
	local Rotators = CollectionService:GetTagged("Rotators")
	ConnectionUp:Disconnect()
end)

game.ReplicatedStorage:WaitForChild("DisableDown").OnServerEvent:Connect(function(player)
	local Rotators = CollectionService:GetTagged("Rotators")
	ConnectionDown:Disconnect()
end)

The RotateUp and RotateDown Remotes is Just for indicating User Input

I Tried The Same method But for Welds, And Both Got This interesting Problem,

So The Canon Head didn’t Move at all(which is Nice) But The Canons itself(which im trying to Rotate) Flew outside of The Baseplate.

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