How would I make the tank head rotate on the x axis only and have the tank barrel rotate on the y axis only?
Pretty much how to make a part/mesh only rotate with CFrame on one axis.
How would I make the tank head rotate on the x axis only and have the tank barrel rotate on the y axis only?
Pretty much how to make a part/mesh only rotate with CFrame on one axis.
Might be what you want?
Either that above or if you want to simplify things:-
barrel.CFrame = CFrame.new(barrel.CFrame.X, 5, barrel.CFrame.Z)
just change it accordingly to what axis u want to change
If you want it to rotate to your mouse’es position, the best way is to make a joint with a weld in it, then get the rotational CFrame between your turret’s base and your mouse. Use :ToOrientation() on that CFrame to get the Y axis, and rotate that joint weld, but CFrame.Angles(0,y,0) to rotate only on the Y axis, do the same but with X axis for the tank barrel. For restrictions, write and if statement saying to only rotate if the X angle is within’ a certain threshold.