コード例 #1
0
        /// <summary>
        /// Try to apply animation to model.
        /// </summary>
        public void Apply(SkinnedMesh skinnedMesh)
        {
            skinnedMesh.AnimationSpeed = animationSpeed;
            for (int i = 0; i < orientations.Count; i++)
            {
                SJoint joint = skinnedMesh.GetAllJoints()[i];
                for (int j = 0; j < positions[i].Count; j++)
                {
                    var poskey = skinnedMesh.AddPositionKey(joint);
                    poskey.Position = positions[i][j];
                    poskey.Frame    = positionsKeyframes[i][j];
                }

                for (int j = 0; j < orientations[i].Count; j++)
                {
                    var rotkey = skinnedMesh.AddRotationKey(joint);
                    rotkey.Rotation = orientations[i][j];
                    rotkey.Frame    = orientKeyframes[i][j];
                }

                for (int j = 0; j < scales[i].Count; j++)
                {
                    var scalekey = skinnedMesh.AddScaleKey(joint);
                    scalekey.Scale = scales[i][j];
                    scalekey.Frame = scalesKeyframes[i][j];
                }
            }
        }