static Transform relativeTransform(Spatial startSpatial,
            Node ancestorNode, Transform storeResult) {
        assert startSpatial.hasAncestor(ancestorNode);
        Transform result
                = (storeResult == null) ? new Transform() : storeResult;

        result.loadIdentity();
        Spatial loopSpatial = startSpatial;
        while (loopSpatial != ancestorNode) {
            Transform localTransform = loopSpatial.getLocalTransform();
            result.combineWithParent(localTransform);
            loopSpatial = loopSpatial.getParent();
        }

        return result;
    }
Calculate a coordinate transform for the specified spatial relative to a
specified ancestor node. The result incorporates the transform of the
starting spatial, but not that of the ancestor.

@param startSpatial the starting spatial (not null, unaffected)
@param ancestorNode the ancestor node (not null, unaffected)
@param storeResult storage for the result (modified if not null)
@return a coordinate transform (either storeResult or a new vector, not
null)
jme3-jbullet/src/main/java/com/jme3/bullet/animation/RagUtils.java