Smooth jump camera?

Essentially, I want the camera to bob down when the character jumps up then bob up for when the character begins to fall down. Then, to return to a normal state after landing.

What I decided to change the camera offset on the y axis to have a “bobbing” view then use the humanoid state and fire the function tweens whenever its that state. The problem is that I don’t know if theres any other efficient method out there as what I’m trying to do isn’t working so well.

TS:Create(HUM, TweenInfo.new(0.5, Enum.EasingStyle.Quint, Enum.EasingDirection.Out), {CameraOffset = Vector3.new(0,-1,0)}):Play()

The tween there is used for the jump so it bobs down and vice versa for falling down by listening to the freefalling event. However,
image

Landed seems to be the only state that isn’t working correctly?

1 Like

Landed isn’t a property of the humanoid. It’s a state of the humanoid. You can use the event StateChanged to check when the humanoid lands.

HUM.StateChanged:Connect(function(oldState, newState)
	if newState == Enum.HumanoidStateType.Landed then
		-- Camera bob
	end
end)
3 Likes

Using this helped the problem, (Could’ve sworn I’ve did statetype :thinking:) But now I’ve ran into a new problem, the Jumping State and Falling State. The Jumping state fires quick but then quickly goes into freefall which is bad since it causes a glitchy look on the screen. So what I tried doing was debounces, didn’t really help.

I put a print in the Jumping State and printed the Camera Offset:
image

What it should output is somewhere in the negatives close to 0, -1 ,0 but since freefall activates right afterwards, it just goes straight to freefalling giving it a glitchy look. How would I fix this?

EDIT: After using some hacky workarounds and back easing styles, I was able to a somewhat desired effect.

When the player jumps, create a loop that loops until the player’s velocity is 0 on the Y axis then manipulate the camera after that.