Learning Curve 1
- kjcoleman7
- Oct 1, 2016
- 2 min read
I have started learning to use the audio functions in the unreal engine and will make informal posts under the heading 'Learning Curve' regarding the problems I come across.
I've started adding sound to an example level in the unreal engine and found the need to animate the movement of a lift. The image below shows the first blueprint I came up with.

I used an 'AddLocalOffset' to the lift mesh with a timeline feeding the delta location. The timeline provides an consistent output of -0.5 to the z-axis. When the timeline finishes the 'LiftDir' boolean variable is set to 'False' and the timeline data is multiplied by -1.0 before being to an 'AddLocalOffset' node so the z direction reverses.
Problems
I had hoped that the lift would return exactly to its starting position and then lower to the same point each time. It didn't. The image below shows the output log of the final offset that the lift reached at its lowest and highest point in turn.

You can see that the offset at the lowest changed from -92.563 to -92.043 and then back again. The high point offset (which should be 0.0) also changes from 13.521 to 14.041. I imagine that it starts with such a large offset because of some skips in the clock feeding the timeline when the level loads. Maybe the problem with this initial large variation from zero could be prevented by delaying the start of the lift timeline until after the level loads. The problem is that even if the lift starts up a few frames later there is still some small variation the the final positions during play. If the timeline skips during the upward cycle a few times in a row the the lift would be rising higher out of position because the motion is based on offsetting from the current position regardless of the intended position.
Solution
Abandon ship. I completely abandoned the idea of running the lift animation using a 'LocalOffset' node and turned to using a 'Level Sequence' instead. This made much more sense. It was quicker and easier and was obviously intended for this purpose. In hindsight I think the use of a 'Local Offset' node should be reserved for creating motion in interactable objects that may move around during play or objects that are not locked in the same position.
Comments