Hello everyone! I’ll cut short, I’ve been making an artillery system, everything works fine, except the movement system. I’m using a Pivot system to move the models. The main model moves perfectly fine, however the artillery barrel is slowly rotating inversely. If I rotate it by 180 degrees, the barrel rotation is completely inversed. Here’s what I mean.
0 Degrees
180 Degrees
As I slowly turn the artillery, it slowly inverses, I’ve tried messing with the code and pivots, but nothing really works. Any help is greatly appreciated!
Useful stuff:
Barrel Pivots
Main Code
--// shell details
local force = 1000
local upforce = 250
--// recoil stuff
local recoil_dist = 2.5
local recoil_time = 0.5
--// turning stuff
local turn_speed = 0.1
local turn_power = 5
local info = TweenInfo.new(recoil_time, Enum.EasingStyle.Circular, Enum.EasingDirection.Out, 0, true)
move.OnServerEvent:Connect(function(player, dir)
if shot_status == true then return end
if dir == "left" then
howitzer.Barrel:PivotTo(howitzer.Barrel:GetPivot()*CFrame.Angles(0,math.rad(turn_power),0))
howitzer.Shield:PivotTo(howitzer.Shield:GetPivot()*CFrame.Angles(0,math.rad(turn_power),0))
elseif dir == "right" then
howitzer.Barrel:PivotTo(howitzer.Barrel:GetPivot()*CFrame.Angles(0,math.rad(-turn_power),0))
howitzer.Shield:PivotTo(howitzer.Shield:GetPivot()*CFrame.Angles(0,math.rad(-turn_power),0))
end
end)