public Quaternion GetLimbRotationAtFrame( int limbIndex, IAnimation animation, int frame) { var trackIndex = limbIndex * 3; // TODO: This doesn't look like it should be needed. if (trackIndex > animation.TrackCount - 1) { trackIndex = 0; } var xTrack = animation.GetTrack(trackIndex); var yTrack = animation.GetTrack(trackIndex + 1); var zTrack = animation.GetTrack(trackIndex + 2); this.WrapFrame_(xTrack, frame, out var xFrame); this.WrapFrame_(yTrack, frame, out var yFrame); this.WrapFrame_(zTrack, frame, out var zFrame); var xFrames = xTrack.Frames; var yFrames = yTrack.Frames; var zFrames = zTrack.Frames; var r2d = Math.PI / 180; var x = this.AngleToRad_(xFrames[xFrame]) * r2d; var y = this.AngleToRad_(yFrames[yFrame]) * r2d; var z = this.AngleToRad_(zFrames[zFrame]) * r2d; return(this.GetQuaternion_(x, y, z)); }