Why are my doors snapping shut sometimes?

I am working with the double door from the Medieval Dungeon assets pack by Epic. The blue print is an arch with two doors in it. I have created a blue print to allow those doors to open when a player character steps on the switch. For all intents and purposes my blue print works, however I discovered a little bug which happens now and again:

When you step on the switch the doors will open but when you step off they do not follow their reverse animation, instead they SNAP closed. You can see this behaviour in the video.

The Door

In the blueprint of the door itself I created the following events:

To talk you through my process here is what I’ve done.

  • I created two custom events for activated and deactivated which represent the states of the button when a player stands on it.
  • I created a timeline which updates the relative rotation of the doors on their Z axis by 90 degrees.
  • I use a Lerp rotator to switch between those values which are 90 degrees. (I heard that using lerps for rotation can give more consistent results.
  • The lerp rotates the doors but uses a multiplier to create a negative value so that the doors both swing the same way.

The Switch

The switch is simply a cylinder with collision detection.

Since the blueprint for the door has both doors in it with the arch, I use a get all actors in class function and then dip into the array.

So, I’m trying to figure out why I randomly get this “snap” behaviour which looks like a timeline jump i.e. it’s not running the timeline it’s simply shifting back to zero and thus loosing the smooth motion.

Anyone got any ideas?

It’s because when your player approaches, you use ‘play from start’, but if he walks away immediately, you use reverse. This means if he’s on the very edge of the volume, the timeline will jump back to play from start again.

Short answer, just use play rather than play from start…

Ah, I totally missed, thank you, I can’t believe it was such a simple thing! I get the feeling I’ve been starting at it too long :sweat_smile:

1 Like