コード例 #1
0
ファイル: modelprocessor.cs プロジェクト: zfedoran/helium
        private static Animation CreateAnimation(SerializableAnimation animationContent)
        {
            Animation animation = new Animation(animationContent.name);

            animation.SetLength(animationContent.length);

            foreach (SerializableTrack trackContent in animationContent.tracks)
            {
                AnimationTrack track = animation.CreateTrack(trackContent.name);

                for (int i = 0; i < trackContent.keyframes.Count; i++)
                {
                    SerializableKeyFrame keyFrameContent = trackContent.keyframes[i];
                    AnimationKeyFrame    keyFrame        = new AnimationKeyFrame
                    {
                        rotation    = keyFrameContent.rotation,
                        scale       = keyFrameContent.scale,
                        translation = keyFrameContent.translation,
                        time        = keyFrameContent.time
                    };

                    track.AddKeyFrame(keyFrame);
                }
            }

            return(animation);
        }