Is there any way to apply a lag to a Camera?

Hi! I’m working with the Side Scroller template. Is there any way to apply a follow lag to the camera when the player jumps?

I think it can be done using a Lerp, but I’m not sure how to tell the camera since it’s inside the component, and of course, it moves with the component itself.

Any ideas?

Thanks!
Luke

Hey Luke di Rago,

This seems to be the best solution I could come up with. Let me know how it works out for you.

Note: This is within the MyCharacter Blueprint in the Side Scroller Project.

Peace

Awesome!! It worked like a charm. I’m actually needing only a lag in Z axis, when it jumps. I’m gonna try to find a more elegant way to do it, since I started breaking and making vectors and now, as you can see, the wires look a set of headphones in a pocket :P.

I’m making a ‘port’ of a game I did in a 2D engine, mainly to learn UE4 and keep myself motivated to finish something. You can play it here to get an idea where I’m going Game Jolt - Games for the love of it

So I’m using the Sidescroller template, but making the pawn simulate pressing right every tick, and giving the player only the control to jump.

Really, thanks a lot for taking time to help me! :smiley:
Luke

If you break things into variables it may look better haha! But spaghetti is always good! I’ve looked at Epic nodes and sometimes, its difficult to get things to look just right. Either way I’m glad I could at least get you going!

Since this thing is spawning a new Camera, I’m losing my ortho width setting (currently in orthographic projection mode), how can I can I put it back ?

A more elegant solution in UE4.10 for those who need it is to add a springarm to the Capsule Component of the player Character BP and attach the camera to it. The springarm has settings for Lag (to the left of the screenshot), and you can enable and define lag and separately enable and define camera rotation lag :slight_smile:

If you want no lag except when the player jumps, I don’t believe this will arrange that on its own without also effecting the sideways camera motion :confused:

Wow, 5 years later and this is still coming in handy. I know no one will see this, but I am so thankful. I am building a 2d game for a school project and this is a perfect little detail! Thanks again!