예제 #1
0
        private static Bone makeBone(Bone.BoneType name, Vector proximalPosition, float length, float width, Vector direction, Vector up, bool isLeft)
        {
            LeapQuaternion rotation = UnityEngine.Quaternion.LookRotation(-direction.ToVector3(), up.ToVector3()).ToLeapQuaternion();

            return(new Bone(
                       proximalPosition,
                       proximalPosition + direction * length,
                       Vector.Lerp(proximalPosition, proximalPosition + direction * length, .5f),
                       direction,
                       length,
                       width,
                       name,
                       rotation));
        }
예제 #2
0
        static Bone MakeBone(Bone.BoneType name, Vector proximalPosition, float length, float width, Vector direction, Vector up)
        {
            Matrix basis = new Matrix();

            basis.zBasis = direction;
            basis.yBasis = up;
            basis.xBasis = direction.Cross(up).Normalized;
            return(new Bone(
                       proximalPosition,
                       proximalPosition + direction * length,
                       Vector.Lerp(proximalPosition, proximalPosition + direction * length, .5f),
                       direction,
                       length,
                       width,
                       name,
                       basis));
        }