public MorphTargetKeyFrameUpdater(Animation animation, IList <float> weights) { this.animation = animation; Name = animation.Name; this.weights = weights; startTime = animation.StartTime; endTime = animation.EndTime; kfs = animation.MorphTargetKeyframes; //Setup in groups of weight id and sort by time. This is somewhat slow, look into better solutions targetKeyframeIds = new int[weights.Count][]; for (var i = 0; i < targetKeyframeIds.Length; i++) { var ids = new FastList <int>(kfs.Count); //Quick initial cap for (var j = 0; j < kfs.Count; j++) { if (kfs[j].Index == i) { ids.Add(j); } } targetKeyframeIds[i] = ids.OrderBy(n => kfs[n].Time).ToArray(); } //Used to cache previous keyframe id's per morph target prevKeyframes = new int[weights.Count]; }