So I made a crouching animation and is playable via pressing a key. I was wondering how I could change the player’s view to look like how it would if I crouched in real life. Basically I am asking how to make the camera shift downwards to make it somewhat realistic.
game.Players.LocalPlayer.Character.Humanoid.CameraOffset=Vector3.new(0,-2,0)
Use cameraoffset
2 Likes
Thanks so much! That worked. I was using the same method just not the same math. Thank you!
in a loop, you could do
local downAmount = 3 -- (studs)
local downCameraOffset = humanoid.CameraOffset + Vector3.new(0, downAmount, 0)
while game:GetService("RunService").Heartbeat:Wait() do
humanoid.CameraOffset = humanoid.CameraOffset:Lerp(downCameraOffset, 0.5)
if (humanoid.CameraOffset - downCameraOffset).Magnitude < 1 then break end
end
2 Likes
Or
game:GetService("TweenService"):Create(game.Players.LocalPlayer.Character.Humanoid,TweenInfo.new(<insert params>),{CameraOffset=Vector3.new(0,-2,0)}):Play()
2 Likes