Hi!
Could someone help me make the turret rotate with the base of the tank?
When I rotate the tank, the turret doesn’t match the base cframe.
As you can see in the videos:
function control()
local targetPos = workspace.Target.Position
local relative = Hub.CFrame:toObjectSpace(CFrame.new(Hub.Connection.WorldPosition,targetPos))
local x,y,z = relative:ToOrientation()
Hub.Weld.C0 = Hub.Weld.C0:Lerp(CFrame.new(relative.p) * CFrame.fromOrientation(math.clamp(x,-maxAngle,maxAngle),0,z),lerpSpeed)
Base.Weld.C0 = Base.Weld.C0:Lerp(Base.CFrame:toObjectSpace(CFrame.new(Base.Connection.WorldPosition,Vector3.new(targetPos.x,Base.Connection.WorldPosition.y,targetPos.z))),lerpSpeed)
end
RunService.Stepped:Connect(control)