Animation.clone() does not change the scope of the frame variables/values

When you do an animation.clone() and then push that animation to another object. Then change the values on the animation keys manually it modifies both the original values and the new cloned animations.

My work around was to do animation = BABYLON.Animation.Parse(animation.serialize()), but I figured the fact the clone does not change the variable scope of the embedded values would be a bug.

https://playground.babylonjs.com/#Q02V3P#20 <- clone
vs
https://playground.babylonjs.com/#Q02V3P#19 <- Serlaize Parse

Actually as I think about it, I bet this is the intended behavior.

There would be situations where you would want to keep them associated and if you need a deep clone you just do the serialize parse method.

1 Like