Пример #1
0
        public void SetToPosition(TransformMatrix tm)
        {
            if (_bone.hasTransform())
            {
                _bone.removeTransform();
            }

            if (tm.isIdentity())
            {
                return; //nothing to do in this case
            }
            else
            {
                _bone.addTransform(tm.ToTransform());
            }
        }
Пример #2
0
        public static Switch CreateAnimationSwitch(Bone bone, Bone fixedBone, int[] animationOrder, int numFrames)
        {
            Switch sw = new Switch();

            sw.reference();

            //add starting position, each animation does the animation and the ending frame, not the starting one :)
            TransformMatrix startPosition = bone.CalculateRelativeMotionFromNeutral(animationOrder[0], fixedBone);

            sw.addChild(startPosition.ToTransform());
            for (int i = 0; i < animationOrder.Length - 1; i++) //not the last animation, there need start and end
            {
                TransformMatrix[] tmTransforms = bone.CalculateInterpolatedMotion(animationOrder[i], animationOrder[i + 1], fixedBone, numFrames);
                foreach (TransformMatrix tform in tmTransforms)
                {
                    sw.addChild(tform.ToTransform());
                }
            }
            sw.unrefNoDelete();
            return(sw);
        }
Пример #3
0
        private void GenerateInertiaSeparator(int arrowLength)
        {
            //if there is no inertia information, do nothing
            if (!this.HasInertia)
            {
                return;
            }

            Separator inert = new Separator();
            Transform t     = _inertiaMatrix.ToTransform();

            if (arrowLength == 0)
            {
                inert.addNode(new ACS());
            }
            else
            {
                inert.addNode(new ACS(45));
            }
            inert.addTransform(t);
            _inertiaSeparator = inert;
        }