Hello! I’ve made a topic like this before but something about it feels… off? It only tilts left and right, and just kinda snaps in place, even with Tweens. I’d make one myself but I suck at coding. I want something that can work for both mobile AND PC. I’ve searched everywhere (DevForum, YouTube, even asking my coding friend [pending]) but to no avail.
Video Reference:
If anyone could give me a short script or some tips they used for this type of movement shown in the video, that would greatly help. Thank you very much in advance
I found a great script for this a while ago, (I forgot who made it but if I find the original post I’ll credit them)
It doesn’t rely on UserInputService which is good because that means it’s supported on multiple platforms and not just PC.
This is an edited version of the script I made to fit my needs for my game:
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local rad = math.rad
local Rot = CFrame.new()
local function GetRollAngle()
local Character = Player.Character
if not Character then
return
end
local Cf = Camera.CFrame
return -Cf.RightVector:Dot(Character.Humanoid.MoveDirection)
end
RunService:BindToRenderStep("RotateCameraInDirectionPlayerIsGoing", Enum.RenderPriority.Camera.Value + 1, function()
local Roll = GetRollAngle() * 2
Rot = Rot:Lerp(CFrame.Angles(0, 0, rad(Roll)),0.075)
Camera.CFrame *= Rot
end)