How can I add a constrictor or a limit for this camera orientate mechanic?

what do you mean moving the cursor changes the output.

Then how is it not moving right or down?

It is can you see the cursor its a dot. And the values change?

The value does look like it changed, can you try hooking it back up to the camera part?

Heres a video;

as you can see it moves left and up but not right and down.

local regX = sensitivity / ((mousePosX > MAX_DIST_X and MAX_DIST_X) or (mousePosX < MIN_DIST_X and MIN_DIST_X) or mousePosX)

what does this do?

and MAX_DIST_X

is this a truthy value like you talked about before?

I figured out how to reverse it. I had to flip the > and < symbols in the regX and regY also I set sensitivity to be a negative number and this game me right and left I just have to figure out how to put it all together and I think I know how.

1 Like
local deadZoneDistance = 200
local sensitivity = 200
local mousePosX = userInputService:GetMouseLocation().X --mouseX
local mousePosY =  userInputService:GetMouseLocation().Y--mouseY

local MIN_DIST_X = deadZoneDistance
local MIN_DIST_Y = deadZoneDistance
local MAX_DIST_X = workspace.CurrentCamera.ViewportSize.X - deadZoneDistance
local MAX_DIST_Y = workspace.CurrentCamera.ViewportSize.Y - deadZoneDistance
			
local regX1 = sensitivity / ((mousePosX > MAX_DIST_X and MAX_DIST_X) or (mousePosX < MIN_DIST_X and MIN_DIST_X) or mousePosX)
local regY1 = sensitivity /((mousePosY > MAX_DIST_Y and MAX_DIST_Y) or (mousePosY < MIN_DIST_Y and MIN_DIST_Y) or mousePosY)
			
local regX2 = -sensitivity / ((mousePosX < MAX_DIST_X and MAX_DIST_X) or (mousePosX > MIN_DIST_X and MIN_DIST_X) or mousePosX)
local regY2 = -sensitivity /((mousePosY < MAX_DIST_Y and MAX_DIST_Y) or (mousePosY > MIN_DIST_Y and MIN_DIST_Y) or mousePosY)
			
local regX = regX1 + regX2
local regY = regY1 + regY2

local mousePos = Vector3.new(regX, regY, 0)
local result = {CFrame = CFrame.new(cameraPart.Position, mousePos)}
local t1 = tweenService:Create(cameraPart, TweenInfo.new(1), result)
t1:Play()

with help from @mnmzc and @aaltUser

1 Like