Help needed with making a Turret face towards Mouse

I tested it anchored and unanchored and it still didnt move.

Did you use the single axis one or the one that rotates on both axis’s? The one with both axis didn’t move to my mouse, but the one that only rotated on y axis did…

Single axis.
(this one)

turret.CFrame = CFrame.new(turret.Position, Vector3.new(mouse.Hit.Position.X,turret.Position.Y,mouse.Hit.Position.Z))
1 Like

That’s very weird. I used that axis, although it is moving towards the mouse still…

1 Like

Is there anything welded onto the turret?

1 Like

Yes, a few cannons and other things are welded to the turret. Also, this is a rig. That might be the problem?

1 Like

have you tried using hinge constraints?

i got this result from using hinge constraints.

if this is similar to what youre looking for, let me know and ill tell you how to set it all up

6 Likes

Yeah, please let me know how to make that. I’ve been attempting turrets facing the player mouse for a long time.

1 Like

if its possible t make a tutorial do it

2 Likes

i seem to have figure out how to make the same thing, but hinge constraint often slips and doesnt rotate in specific speed

if tank.Turret:FindFirstChild("Turret") then
						local point = CFrame.new(tank.Turret.Turret.Position, camera.CFrame.LookVector + tank.Turret.Turret.Position)

						local x, y, z = point:ToOrientation()
						tank.TurretPlace.HingeConstraint.TargetAngle = math.deg(y) - tank.PrimaryPart.Orientation.Y
						--tank.Turret.Turret.HingeConstraint.TargetAngle = math.deg(x) - tank.Turret.Center.Orientation.Y		
					end
if not newChassis.TurretPlace:FindFirstChild("HingeConstraint") then
		local turretWeld = Instance.new("HingeConstraint", newChassis.TurretPlace)
		turretWeld.ActuatorType = Enum.ActuatorType.Servo
		turretWeld.AngularResponsiveness = 5
		turretWeld.AngularSpeed = 5000000000
		turretWeld.ServoMaxTorque = 5000000000

		local att0 = Instance.new("Attachment", newChassis.TurretPlace)
		att0.WorldCFrame = newChassis.TurretPlace.CFrame
		att0.WorldOrientation = Vector3.new(0,0,90)
		local att1 = Instance.new("Attachment", newTurret.Center)
		att1.WorldCFrame = newTurret.Center.CFrame
		att1.WorldOrientation = Vector3.new(0,0,90)

		turretWeld.Attachment0 = att0
		turretWeld.Attachment1 = att1
	end

any idea how i would make hinge constraint rotate at specific speed

2 Likes

Hey there @letris,

I myself am attempting to make a turrent for my tank just like the way you’ve made it. If you could show me how you achieved this and how you set it up, it would be such great help.

Thanks!!!

1 Like