Topic was automatically imported from the old Question2Answer platform.
Asked By
connortbot
I saw a previous question asking about how to make the camera follow the player but with a delay, giving it a bit of a bouncy look. The answer was to use an InterpolatedCamera, but that’s 3D.
I haven’t found any methods that I can use in Camera2d, so how would this be achieved?
All InterpolatedCamera in 3D does is lerp the camera’s transform. You can do this in 2D yourself with something along these lines:
extends Camera2D
export (NodePath) var target_path
export var speed = 10
var target
func _ready():
if target_path:
target = get_node(target_path)
func _physics_process(delta):
position = lerp(position, target.position, speed * delta)
You can play around with how you move the camera depending on what effect you want. It’s really just about moving the camera independent of, but linked to, the target.
Idk if this is what you are talking about, but you can set drag margin enabled on a camera 2d, then set the margin to be 0, and then turn smoothing on.