How would CFrame Turrets be made?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

CFrame Turrets that have a limited traverse speed, I’m unsure what math would be used for limiting how quickly the turret would traverse according to a set amount of degrees per second

MouseDelta isn’t a event, do I use InputChanged?

Use another person’s answer, his answer was obviously made by AI.

I will make a turret script and post it here tomorrow.

Hey good news. You don’t have to script this. When you create your turret you will use
A base part the turret rotates off of, it will use an Attachment. Along with that you can add a HingeConstraint. The HingeConstraint let’s you input all the things you’re talking about.

I refuse to deal with Constraints, I can do pretty much everything CFrame related minus what I mentioned in this post, I don’t know much about MouseDeltas and stuff though

I spent forever trying to make working tanks with tracks. This is the way to go …

local targetCFrame = CFrame.new()
local alpha = 0.5

local turret = script.Parent -- Change this to where your turret is

game:GetService("RunService").Stepped:Connect(function()
	local tcf = turret.CFrame

	local rootoffset = (targetCFrame:Inverse() * tcf) : Inverse()

	local targetAngle = -math.atan2(rootoffset.Z, rootoffset.X) - (math.pi / 2)

	turret.CFrame *= CFrame.Angles(0, targetAngle * alpha, 0)
end)

alpha: the smoothness of the turret. If alpha is 1, the turret will instantly snap to the target. If alpha is 0, the turret won’t move.

targetCFrame: where the turret points to.

Keep in mind that this script only rotates the turret around its Y axis, and the turret must be anchored for it to work.

For limiting the angles per second, you would have to use math.clamp on the expression targetAngle * alpha (keep in mind that this is in radians)

For consistency with frames per second, you would need to use DeltaTime.

What would be the :PivotTo() way of doing this?

nvm I figured it out, just playing with the Alpha after getting it working on 2 axes with both models