How it would be possible to make a camera like this ?
What would i need?
Looks like the angles and the Y axis are being changed, which gives it that smoothness
How it would be possible to make a camera like this ?
What would i need?
Looks like the angles and the Y axis are being changed, which gives it that smoothness
I know, thanks, but it’s not what i am looking for, It doesn’t change the angles, and doesn’t teach exactly what are the functions there
Pretty sure the side movement’s are all static angles, and for the viewbobbing you can just use math.sin
This is most likely what uglyburger did
I see, what do you mean by “static angles” ?
I’m assuming you’re talking about the camera tilting. You use the humanoid’s move direction to get this result, here’s how I did it:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Rotation = CFrame.new()
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value + 1, function()
local Character = Player.Character
if not Character then
return
end
local Humanoid = Character.Humanoid
local Roll = Camera.CFrame.RightVector:Dot(Humanoid.MoveDirection) * 2
Rotation = Rotation:Lerp(CFrame.Angles(0, 0, math.rad(Roll)),0.075)
Camera.CFrame *= Rotation
end)
( does not contain the bobbing effect, only the tilt effect. )
Thanks, i’d say tilt is a part of it, but i was mostly talking about the bob from the angles, i guess i could make what @neviquatro Said about the bobbing in the y axis
Try this:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local Player = Players.LocalPlayer
local Camera = workspace.CurrentCamera
local Rotation = CFrame.new()
local Bobbing = CFrame.new()
-- adjust to your preferences
local ALPHA = 0.1
local TILT = 2
RunService:BindToRenderStep("Camera", Enum.RenderPriority.Camera.Value + 1, function(dt)
local Character = Player.Character
if not Character then
return
end
local Humanoid = Character.Humanoid
local Offset = dt / (1/60)
local MoveDirection = -Humanoid.MoveDirection
local IsMoving = MoveDirection.Magnitude > 0.01
local Roll = Camera.CFrame.RightVector:Dot(MoveDirection) * TILT
Bobbing = Bobbing:Lerp(
CFrame.Angles(
IsMoving and
math.rad(math.sin(time() * 20)) / 3.5 * Offset or
math.rad(math.sin(time())) / 100 * Offset,
IsMoving and
math.rad(math.sin(time() * 10)) / 3 * Offset or
math.rad(math.cos(time())) / 100 * Offset,
math.rad(Roll) * Offset -- add camera tilt
),
ALPHA
)
Camera.CFrame *= Bobbing
end)
Thanks, Altough, i found another solution, kinda similar, But thanks, I’ll mark your post as a solution , i mostly know what’s happening there now, Also, the camera angles in your code seems to change in a curved-motion
ps : sorry for taking too long to respond
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.