Lerp or animate?

Hey all,

I’m just curious if there is a best practice scenario for this movement that I’m doing on a custom GUI. To this point, I have not worked with any animation files as all of the movement is pretty basic in my game so far. As I’m designing my GUI, I have just completed an effect where a couple of directional arrows change position and rotation over time using Lerp on the floats of the rotation and position vectors and since the process is repeated every time that the character enters/exits these triggers, which is quite often, I was thinking that maybe it would be better to have an animation in memory. There would only be a single movement stored that I believe would be able to run in reverse when needed. Would this be a better approach for optimization than what I’m currently doing ( running 2 separate lerps (one for rotation and one for position) every time it needs to run )???

If an animation would be better, would it also be safe to assume that it would be better to use animations in place of some of my simple translations used on the child objects of my player ( which check their location every frame until they reach the target position ), since these translations are repeated time and time again???

Since it is a game for mobile devices, I’m just trying to find out where to draw the line in between memory consumption and processing overhead… Since they are simple movements that only include 1 object at a time, is there really any performance gain since the animation is still processed??

Sorry if this sounds super novice.


Well I use animations for those kind of effects because they are far more flexible than trying to work out all of the things you might change using Lerps etc. There appears to be no adverse performance in my games (mobile) for animations, but not really any significant benefit either (which probably depends on how well your Lerp/checking code is written).