[Solved] Paralax and lerp

So I have paralaxing working on all my levels, but today I just learned about “Lerp”. When I went to apply it to all of the layers, I lost my paralaxing effect that I had.

Coding before

Change the X position of the camera (layer: “bg”): Set to Player.X()*0.75

Coding after

Change the X position of the camera (layer: “bg”): Set to lerp(CameraX(), Player.X()*0.75, 0.08)

When I changed it, the lerping works, but now all layers are fixed to the same scroll rate, does anyone know how to keep the paralaxing while having the “lerp” work?

I hate when this happens, but I just realized how to do it shortly after posting, and now I can’t delete my question xD

But for anyone who finds this in the future, put the “*0.75” after the closed brackets of the “lerp”

2 Likes

In most cases your parallax layers should be set up based off your main camera, rather than reproducing it.

So if your main camera is already using lerp, your bg layer just needs CameraX("",0)*0.75

No need for multiple lerps.

That said, if your main camera isn’t using lerp, your expression is totally fine for additional layers.

1 Like

Oh thank you! I didn’t know that.

1 Like