Applying x-axis offset to lerp

Godot Version

4.2

Question

I have this follow_player() function that uses lerp to make an object follow the player on the X-axis:

The problem is that it only applies the offset in the positive direction (when the player is moving right). If the player moves to the left, the object collides with the player. How do I apply the offset to both directions?

My first guess is that “offset” is only positive. Where is it defined?

It’s actually negative. It’s in the class as var offset = - 1.5. How would I make it positive and negative?

Apologies, I misread. I’m not 100% certain but you print out your three lerpf function inputs to see if they match your assumptions.