I'm trying to get the camera to follow the mouse.
https://vimeo.com/266586757 -- I'm very close but its kind of weird because the speed changes and doesn't really stay on track with the mouse.
https://vimeo.com/266512080 -- part invis
I'm assuming that it has something to do with my delta (change in pos)
------------------------------------------------
local Player = game.Players.LocalPlayer
local move_vector = Vector3.new(0,0,0)
local speed = .001
local scroll_speed = 6
local mouse = game.Players.LocalPlayer:GetMouse()
local lastx, lasty = mouse.X, mouse.Y
local userInput = game:GetService("UserInputService")
local runService = game:GetService("RunService")
local focus = Instance.new("Part")
focus.Anchored = true
focus.CanCollide = false
focus.Transparency = 1
focus.Size = Vector3.new(0.1,0.1,0.1)
focus.Position = Vector3.new(0,2,0)
focus.Parent = Player
focus.Name = "Focus"
local function Panned(input, processed)
if not processed and input.UserInputType == Enum.UserInputType.MouseMovement then
local delta = input.Delta
if userInput.MouseBehavior ~= Enum.MouseBehavior.LockCenter then
-- If locked, then calculate delta:
delta = Vector2.new(mouse.X - lastx, mouse.Y - lasty)
end
lastx, lasty = mouse.X, mouse.Y
panDeltaMouse = delta
end
end
------------------------------------------------
userInput.InputChanged:Connect(function(input,processed)
if input.UserInputType == Enum.UserInputType.MouseMovement and MouseButton then
Panned(input,processed)
move_vector = move_vector+Vector3.new(panDeltaMouse.X,0,panDeltaMouse.Y)
print("Moving to: ",move_vector)
end
end)
------------------------------------------------
game:GetService("RunService").RenderStepped:Connect(function()
focus.Position = focus.Position + (move_vector)*speed
end)

2 comments
Sorry I try help you but there is some information missing..
The only thing that is missing is the script that follows the moving brick which is irrelevant to my question. Other than that are the variables. I'll add them if that makes it more clear.