My character is moving like crazy

I’m trying to make a boss for my 2d game. It is suposed to move randomly in the air in a bounding box. I want the movement to be smooth with some variation so it feels natural.
Currently I have a BP based on “PaperCharacter”. I had to set the gravity to 0 so it’s not falling.
As for the movement I tried using a timeline and it did not end up well.


The timeline is set to go from time 0, value 0 to time 3, value 1.
My character is moving like every frame in a random spot teleporting around, but after 5 seconds it works fine and it’s not teleporting every frame. If I try to run the timeline from the start, it will move every frame.

Anyway, I’m not sure if using timelines is the best approach for what I need, so feel free to come up with a new idea. Navigable mesh and “Move AI to” did not work for some reason.

  1. You need to save initial location to a variable before playing the timeline, otherwise lerp receives wrong values.
  2. Use PlayFromStart, not Play.
1 Like

It’s moving all over the place because every tick the timeline does you’re asking for a new random point in the bbox. So Like Tuerer says if you wanna lerp you’d need to store start and end locations every time you set new ones.

If you want something simpler you could just use “vinterp to” instead of a timeline and continuously tick the movement towards a target location, something along the lines of this:

3 Likes