Esempio n. 1
0
        public void applyChainState(FKChainState chain)
        {
            Vector3    startTranslation = parent.Translation;
            Quaternion startRotation    = parent.Rotation;

            FKLinkState linkState = chain[Owner.Name];

            //Figure out the new position using the parent's position.
            Vector3    newTrans = startTranslation + Quaternion.quatRotate(startRotation, linkState.LocalTranslation);
            Quaternion newRot   = startRotation * linkState.LocalRotation;

            //Transform to the real center point from the center of rotation
            newTrans -= Quaternion.quatRotate(ref newRot, ref centerOfRotationOffset);

            this.updatePosition(ref newTrans, ref newRot);

            if (ChainStateApplied != null)
            {
                ChainStateApplied.Invoke(this, chain);
            }

            foreach (var child in children)
            {
                child.applyChainState(chain);
            }
        }
Esempio n. 2
0
        public void applyChainState(FKChainState chain)
        {
            updateAction = () =>
            {
                FKLinkState linkState = chain[Owner.Name];

                Vector3    trans = linkState.LocalTranslation;
                Quaternion rot   = linkState.LocalRotation;

                this.updatePosition(ref trans, ref rot);

                if (ChainStateApplied != null)
                {
                    ChainStateApplied.Invoke(this, chain);
                }

                foreach (var child in children)
                {
                    child.applyChainState(chain);
                }
            };
        }