diff --git a/jme3-core/src/main/java/com/jme3/anim/AnimLayer.java b/jme3-core/src/main/java/com/jme3/anim/AnimLayer.java index a4f89f1d40..9b9990e91d 100644 --- a/jme3-core/src/main/java/com/jme3/anim/AnimLayer.java +++ b/jme3-core/src/main/java/com/jme3/anim/AnimLayer.java @@ -189,24 +189,25 @@ public void setTime(double animationTime) { * current Action, in seconds */ void update(float appDeltaTimeInSeconds) { - if (currentAction == null) { + Action action = currentAction; + if (action == null) { return; } - double speedup = currentAction.getSpeed() * composer.getGlobalSpeed(); + double speedup = action.getSpeed() * composer.getGlobalSpeed(); double scaledDeltaTime = speedup * appDeltaTimeInSeconds; time += scaledDeltaTime; // wrap negative times to the [0, length] range: if (time < 0.0) { - double length = currentAction.getLength(); + double length = action.getLength(); time = (time % length + length) % length; } // update the current Action, filtered by this layer's mask: - currentAction.setMask(mask); - boolean running = currentAction.interpolate(time); - currentAction.setMask(null); + action.setMask(mask); + boolean running = action.interpolate(time); + action.setMask(null); if (!running) { // went past the end of the current Action time = 0.0;