i want to make a action game which is first person, how would I make it so that the player lands having the camera go down a little then go back to the normal height? for example:
when the player lands on the truck the player gets to have the camera down
(I thought about using animations but there isn’t a landing animation)
Hi!
Hm… As I understand it, you want the camera to “shake” a little after the fall?
local humanoid = game.Players.LocalPlayer.Character:WaitForChild("Humanoid")
tween_ser = game:GetService("TweenService")
function MagicBubble(offset)
local To = tween_ser:Create(humanoid,TweenInfo.new(0.3),{CameraOffset = humanoid.CameraOffset - Vector3.new(0,offset,0)})
local From = tween_ser:Create(humanoid,TweenInfo.new(0.3),{CameraOffset = humanoid.CameraOffset})
To:Play()
To.Completed:Wait()
From:Play()
From.Completed:Wait()
end
humanoid.StateChanged:Connect(function(old,new)
if new == Enum.HumanoidStateType.Landed then
MagicBubble(1)
end
end)
If im not wrong you could just change the HumanoidOffset in the Y axis when the Humanoid’s State Changes to Landed.
EDIT : For Smooth interpolation of the HumanoidOffset , you could use a for loop or tweenservice. To detect Humanoid State Change , use the Event Humanoid.StateChanged which returns the old and new state and check whether the new state is Landed.
Humanoid.StateChanged:Connect(function(_,new)
if new == Enum.HumanoidStateType.Landed then
-- Change Humanoid offset here
print("Landed")
end
end)