The best way to explain this would be something similar to that of quake
When strafing, the players camera should tilt to the left or right, giving this effect.
I don’t really know how I could go about doing this though…
3 Likes
Change the CaneraOffset if the player.
ok but how
11 Likes
You could use the dot product of (I think) the camera’s look vector RightVector and the Humanoid’s MoveDirection to get the direction (which can only be left or right) that the humanoid is moving towards relative to the camera, then use that to tilt the camera in it’s Z (roll) axis.
It’s kind of hard to explain here but here’s a somewhat related post on how you’d do that. I’ll see if I can pop a working demo in a bit
2 Likes
This should be what you’re looking for?
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local function GetRollAngle()
local Character = Player.Character
if not Character then
return
end
return Camera.CFrame.RightVector:Dot(Character.Humanoid.MoveDirection)
end
RunService:BindToRenderStep("RotateCameraInDirectionPlayerIsGoing", Enum.RenderPriority.Camera.Value + 1, function()
local Roll = -GetRollAngle() -- Divide or multiply to make the angle bigger or smaller if you want.
-- If you want more specific angling, I think you could get the arccos of
-- this and then tweak it a little bit.
Camera.CFrame = Camera.CFrame * CFrame.Angles(0, 0, Roll)
end)
12 Likes