So just a quick question, you basically want a system where when you click and drag, it moves the camera around?
Edit: If that’s a yes, then it is totally do-able. It’s been done in many games before, and can still be done.
So just a quick question, you basically want a system where when you click and drag, it moves the camera around?
Edit: If that’s a yes, then it is totally do-able. It’s been done in many games before, and can still be done.
Yeah charlimit
So you’re looking for an effect like this?
^ Video is from a game I’m working on rn with a few other people.
Ah, not that. In my game you should hold down on the screen to move around and see what’s what. It’s not an effect like that I’m looking for, sorry.
Edit: I saw your reply and I realised you read it wrong so I made it more clear on what I’m trying to achieve.
The camera’s moving, not the game actually. So you want to be able to basically “scale” the viewport where you can adjust what part of the screen can see the workspace?
You can use a viewport frame that replicates everything in the workspace using a screengui and adding world model then making it draggable here’s a video on youtube that explains how to use worldmodel and viewport frames
is that even possible to achieve?
Sorry I think you’re all thinking this is more complex than it is. I just want the camera to move with the mouse when held down.
Let me see what I can do, hold on.
I got you man im working on it right as we speak
Yeah Is basically hard, you want your camera move just like in avatar editor? where you can inspect your items?
He want his camera to be draggable, why are you mentioning viewport?
Making camera draggable is different thing than a viewport frame.
Have you ever played Township or one of those tycoon games on the App Store? The camera movement system like that is what I’m looking for but @dexanddeb says he understands what I’m talking about so I should be ok.
Ohh, understandable.
I can try making it, I am not so familiar with this kind of stuff, but I’ll try.
Do you need to hold left mouse button to move your camera?
Left or right and having it work on mobile would be great too.
Make a part in Workspace named “CamPlace” and then set orientation to “-90, 0, 0”
Uploading: image.png…
then insert a local script in starterplayer scripts doesn’t matter what you name it
and insert this into the local script:
local UserInputService = game:GetService("UserInputService")
local RunService = game:GetService("RunService")
local plr= game.Players.LocalPlayer
local char = game.Workspace:WaitForChild(plr.Name)
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = "Scriptable"
Camera.CFrame = CFrame.new(0,0,0)
Camera.CFrame = game.Workspace.CamPlace.CFrame
local W,A,S,D,NotMoving = false,false,false,false,true
local function KeepMoving()
repeat
if W then
Camera.CFrame = Camera.CFrame + (Camera.CFrame.UpVector * 0.4)
end
if S then
Camera.CFrame = Camera.CFrame + (Camera.CFrame.UpVector * -0.4)
end
if A then
Camera.CFrame = Camera.CFrame + (Camera.CFrame.RightVector * -0.4)
end
if D then
Camera.CFrame = Camera.CFrame + (Camera.CFrame.RightVector * 0.4)
end
RunService.RenderStepped:Wait()
until NotMoving
end
local function MoveBegan(actionName,inputState,input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if UserInputService:IsKeyDown(Enum.KeyCode.W) then
W = true
NotMoving= false
end
if UserInputService:IsKeyDown(Enum.KeyCode.A) then
A = true
NotMoving= false
end
if UserInputService:IsKeyDown(Enum.KeyCode.S) then
S = true
NotMoving= false
end
if UserInputService:IsKeyDown(Enum.KeyCode.D) then
D = true
NotMoving= false
end
end
if W and not A and not S and not D then
KeepMoving()
elseif not W and not A and not S and D then
KeepMoving()
elseif not W and not A and not S and D then
KeepMoving()
elseif not W and not A and not S and D then
KeepMoving()
end
end
local function MoveEnded(input, gpe)
if input.KeyCode == Enum.KeyCode.W then
W = false
elseif input.KeyCode == Enum.KeyCode.S then
S = false
elseif input.KeyCode == Enum.KeyCode.D then
D = false
elseif input.KeyCode == Enum.KeyCode.A then
A = false
end
end
if not W and not S and not D and not A then
NotMoving = true
else
NotMoving = false
end
game:GetService("ContextActionService"):BindAction("MoveCam" , MoveBegan, false,Enum.KeyCode.W, Enum.KeyCode.A, Enum.KeyCode.S, Enum.KeyCode.D)
UserInputService.InputEnded:Connect(MoveEnded)
wait(10)
print("Script Is Functional")
You can edit this to move using the mouse
oh, if that’s the case, lock the camera, and you can use game.Workspace.currentcamera, something like this, lock the Y to a Y coord, then, you can use user input mouse to detect when mouse is held down, then do math behind the initial press, and the let go, to then move the X and Y coords.
I actually currently have a WASD camera move script and I’m trying to switch from that to using the mouse for a faster/smoother experience and compatibility. I did try to change it but it didn’t even get close to working thus why I created this topic.