Is it possible to use lerp with camera look_at to ease camera movements as it follows its target??

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Macryc

Hi All!
I have a scene set up in which the camera follows a rigid body using the look_at_from_position function. Is it possible to interpolate its movements with something like lerp so that the movements are smoother and a tad delayed. I am after something like this, only in 3d:

This looks more like the classic velocity trick (vector3 - vector3)*-1 and use it as velocity to the camera

AiTechEye | 2019-12-31 22:54

Thanks. How do you use this trick in conjunction with ‘look at from position’? As in, what is the syntax? Do you have an example?

Macryc | 2020-01-01 12:27

:bust_in_silhouette: Reply From: AiTechEye
var c
var vel = Vector3()
var speed = 2

func _process(delta):
	var a = $RigidBody.global_transform.origin
	var b = c.global_transform.origin
	# adds cam position from body
	b = Vector3(b.x+2,b.y-2,b.z)
	# cam velocity
	vel += ((b-a)*-1)*(delta*speed)
	# cam pos + velocity
func _ready():
	c =
	c.current = true