Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How can I make horizontal camera movement?

Asked by 5 years ago

So I'm trying to create camera movement like in DooM 1-2, and I made this local script

player = game.Players.LocalPlayer
local Character = player.Character or player.CharacterAdded:Wait()
local Camera = workspace.CurrentCamera

repeat wait()
Camera.CameraType = Enum.CameraType.Scriptable
until Camera.CameraType == Enum.CameraType.Scriptable

Camera.CameraSubject = Character.Head
Camera.CFrame = Character.Head.CFrame

Of course I did it wrong, how can I make the camera move horizontally? (Using the mouse.)

1 answer

Log in to vote
0
Answered by 5 years ago

From my experience making custom camera systems, a first person shooter requires a custom controls and camera system.

The reason why your provided script doesn't work at all is because you aren't changing your camera's CFrame every frame. You can try BindOnRenderStep, but you will get unwanted results with the controls (e.g camera going crazy when going backwards.)

In order to create a custom camera and controls systems, you must overwrite the default camera and controls scripts.

In order to overwrite these, you must place two localscripts named CameraScript and ControlScript in game.StarterPlayer.StarterPlayerScripts.

If you need guidance on the controls system, you can go by my game's control script here.

If you need more personal help, join the ScriptingHelpers discord and ping me at kernelmode#0213.

Ad

Answer this question