public void clearMotion()
 {
     motion        = null;
     animationTime = 0;
     frameIdx      = 0;
     speedFactor   = 1.0f;
     playAnimation = false;
     numFrames     = 0;
     maxAnimatTime = 0;
     init          = false;
 }
        public void ProcessMotionString(string motionString, Vector3 offset, bool startAnimation = true)
        {
            string oldSkeletonModel = motion.skeletonModel;

            motion = JsonConvert.DeserializeObject <CAnimationClip>(motionString);
            motion.scaleTranslations(scaleFactor);
            motion.translateFrames(offset);
            frameTime     = motion.getFrameTime();
            animationTime = 0;
            frameIdx      = 0;
            speedFactor   = 1.0f;
            playAnimation = startAnimation;
            numFrames     = motion.GetNumFrames();
            maxAnimatTime = numFrames * frameTime;
            init          = true;
        }
        public void ProcessMotionBytes(byte[] motionBytes, Vector3 offset, bool startAnimation = true)
        {
            annotation       = null;
            legacyAnnotation = null;
            Stream ms = new MemoryStream(motionBytes);

            ms.Seek(0, SeekOrigin.Begin);
            var            bz2InputStream = new BZip2InputStream(ms);
            BsonReader     reader         = new BsonReader(bz2InputStream);
            JsonSerializer serializer     = new JsonSerializer();

            motion = serializer.Deserialize <CAnimationClip>(reader);
            motion.scaleTranslations(scaleFactor);
            motion.translateFrames(offset);
            frameTime     = motion.getFrameTime();
            animationTime = 0;
            frameIdx      = 0;
            speedFactor   = 1.0f;
            playAnimation = startAnimation;
            numFrames     = motion.GetNumFrames();
            maxAnimatTime = numFrames * frameTime;
            init          = true;
        }