Interpolation over time

I want to interpolate a value over a set time and not use a speed. I cannot use a timeline as I do not have access to it. Is this possible?

Basically I want something to move from its start position, to its target position over 2 seconds.

Why can’t you use a timeline in the actor class of the component you want to move?

1 Like

The class is a “StaticMesh” override class so I do not think I can use timelines in that. This is for a sliding door on a van.

He meant a TL in the underlying class owning the component; which would work more than OK for 1 door. Setting up multiple door opening / closing simultaneously, would be a tad trickier.

tl;dr: since vans generally have 1 sliding door, I’d use a TL in the car actor and move on… Other than that, read on.


Consider using a Timer:

Pros

  • you can choose how fast they fire
  • decoupled from framerate by default
  • Tick can sample elapsed time (and / or incorporate delta time)
  • use their elapsed / remaning time as Lerp alpha
  • can be (un)paused
  • you can incorporate a curve to mimic that of a TL
  • unlike a TL, it can live inside a component

Cons:

  • not as neat as a TL and you must script the entire behaviour

Probably much lighter on resources than a timeline component. Probably.

1 Like

Adding to this, now that I know its a vehicle…

If the vehicle is a skeletal mesh, rig it and use an animation to move the door.