So I created this draggable iso camera but when I drag over the buildings it like makes the camera zoom out

Hey, so yeah basically the title says pretty much all

Heres a video of the problem

Code

local TweenService = game:GetService("TweenService")
local UserInputService = game:GetService("UserInputService")
local camera = workspace.CurrentCamera
local IsoCamPart : Part = workspace.Cam
camera.CameraType = Enum.CameraType.Scriptable
camera.FieldOfView = 5
camera.CFrame = IsoCamPart.CFrame

local player = game.Players.LocalPlayer
local mouse = player:GetMouse()

local dragOrigin

UserInputService.InputBegan:Connect(function(input, gameProcessedEvent)
   if gameProcessedEvent then return end
   if input.UserInputType == Enum.UserInputType.MouseButton2 then
      dragOrigin = mouse.Hit.Position
   end
end)

game:GetService("RunService").RenderStepped:Connect(function(deltaTime)
   if UserInputService:IsMouseButtonPressed(Enum.UserInputType.MouseButton2) then
      local difference = (dragOrigin - mouse.Hit.Position)
      local tween = TweenService:Create(camera, TweenInfo.new(.35), {CFrame = camera.CFrame + difference})
      tween:Play()
   end
end)

Is it because the buildings are taller than the basepart, moving the camera back when touching them?

Your script is continously adding the difference onto the existing camera CFrame on every render frame without resetting. This causes the Tween goal to keep incrementing when you hold the mouse button

Alright so instead of using the mouse position I just did a ViewportPointToRay and then I used the origin and its working flawlessy, thanks!

hey! is there anyway you can share your new code? I’ve been trying to do this for a while