Ejemplo n.º 1
0
 void fkElement_ChainStateApplied(FKElement element, FKChainState chainState)
 {
     foreach (String name in chain.ChainStateNames)
     {
         var state = chainState[name];
         chain.setLinkState(name, state.LocalTranslation, state.LocalRotation);
     }
 }
Ejemplo n.º 2
0
        public void addToChainState(FKChainState chain)
        {
            chain.setLinkState(Owner.Name, Owner.Translation, Owner.Rotation);

            foreach (var child in children)
            {
                child.addToChainState(chain);
            }
        }
Ejemplo n.º 3
0
        public void addToChainState(FKChainState chain)
        {
            Quaternion inverseParentRot = parent.Rotation.inverse();
            Vector3    parentTrans      = parent.Translation;

            Quaternion ourRotation = Owner.Rotation;

            //Figure out the translation in parent space, first, however, we must transform the center of rotation offset by the current rotation.
            //This makes the recorded translation offsets relative to the center of rotation point in world space instead of the center of this SimObject.
            Vector3 localTranslation = Owner.Translation + Quaternion.quatRotate(ref ourRotation, ref centerOfRotationOffset) - parentTrans;

            localTranslation = Quaternion.quatRotate(inverseParentRot, localTranslation);

            Quaternion localRotation = inverseParentRot * ourRotation;

            chain.setLinkState(Owner.Name, localTranslation, localRotation);

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