Need help with fixing a tank barrel Y rotation bug

Hi, developers

After finishing the X/Z Rotation for my tank turret, I needed to do the Y elevation for the barrel, I’m running into a slight problem,

When you use the W/S to move the barrel up/down, the whole turret moves with it. here is a video demonstrating my issue

:

It uses normal weld (Not WeldConstraint) to move up down, here is my code to mvoe tur turret Up/Down, Side/Side

local seat = script.Parent
local driver = seat.Occupant

local turret = script.Parent.Parent.Turret

local weld = script.Parent.Parent.Body.TurretWeld
local weld2 = script.Parent.Parent.Barrel.TurretWeld

while true do
	wait()
	
	if seat.Steer == -1 then
		weld.C0 *= CFrame.Angles(0,0.003,0)
	end
	
	if seat.Steer == 1 then
		weld.C0 *= CFrame.Angles(0,-0.003,0)
	end
	
	if seat.Throttle == 1 then
		weld.C0 *= CFrame.Angles(-0.005,0,0)
	end
	
	if seat.Throttle == -1 then
		weld.C0 *= CFrame.Angles(0.005,0,0)
	end
end

Is there any fix to this, if so, help is greatly appreciated!

1 Like

Seems like a rigging problem, I recommend using another weld in order to separate turret barrel and turret. Also you can replace the weld with a Motor6D as you can control the points where the turrets rotate from like a character rotates it’s arm with a plugin like RigEdit lite.

Also turret.

I’m new to motor6d, how do I use it?

Same as welds but with a plugin to control the joint position see a plugin like rig edit and a tutorial on YouTube for how to rig a character.