Cannot read property "frame" of undefined at Animation.ts:831

I’m trying to figure out how this could possibly work:

        for (var key = startKeyIndex; key < keys.length; key++) {
            var endKey = keys[key + 1];

            if (endKey.frame >= currentFrame) { <<<<<<<<<<<<<<<<<<<
                state.key = key;
                var startKey = keys[key];
                var startValue = this._getKeyValue(startKey.value);
                if (startKey.interpolation === AnimationKeyInterpolation.STEP) {
                    return startValue;
                }

This seems like key + 1 will always go out of bounds. Changing the statement to “keys < keys.length - 1” definitely improves it.

This has been fixed 4 months ago: Woot! found a bug in animation engine ;) · BabylonJS/Babylon.js@742be17 · GitHub

Thanks a ton for reporting it by the way :slight_smile:

1 Like

Oh, we’re just out of date? Cool. :slight_smile:

2 Likes