예제 #1
0
    private static RopeData.TransformInfo ComputeTransformInfo(UltimateRope rope, GameObject node, GameObject parent)
    {
        RopeData.TransformInfo transformInfo = new RopeData.TransformInfo();

        transformInfo.goObject      = node;
        transformInfo.strObjectName = node.name;

        transformInfo.tfParent = parent == null ? null : parent.transform;

        if(transformInfo.tfParent != null)
        {
            transformInfo.v3LocalPosition   = transformInfo.tfParent.InverseTransformPoint(node.transform.position);
            transformInfo.qLocalOrientation = Quaternion.Inverse(transformInfo.tfParent.rotation) * node.transform.rotation;
        }
        else
        {
            transformInfo.v3LocalPosition   = node.transform.position;
            transformInfo.qLocalOrientation = node.transform.rotation;
        }

        transformInfo.v3LocalScale = node.transform.localScale;

        UltimateRopeLink ropeLink = node.GetComponent<UltimateRopeLink>();

        if(ropeLink != null)
        {
            transformInfo.bExtensibleKinematic = ropeLink.ExtensibleKinematic;
            transformInfo.bLinkMarkedKinematic = node.rigidbody != null ? node.rigidbody.isKinematic : false;
        }
        else
        {
            transformInfo.bExtensibleKinematic = false;
            transformInfo.bLinkMarkedKinematic = false;
        }

        return transformInfo;
    }
    private static RopeData.TransformInfo ComputeTransformInfo(UltimateRope rope, GameObject node, GameObject parent)
    {
        RopeData.TransformInfo transformInfo = new RopeData.TransformInfo();

        transformInfo.goObject      = node;
        transformInfo.strObjectName = node.name;

        transformInfo.tfParent = parent == null ? null : parent.transform;

        if(transformInfo.tfParent != null)
        {
            transformInfo.v3LocalPosition   = transformInfo.tfParent.InverseTransformPoint(node.transform.position);
            transformInfo.qLocalOrientation = Quaternion.Inverse(transformInfo.tfParent.rotation) * node.transform.rotation;
        }
        else
        {
            transformInfo.v3LocalPosition   = node.transform.position;
            transformInfo.qLocalOrientation = node.transform.rotation;
        }

        transformInfo.v3LocalScale = node.transform.localScale;

        transformInfo.bExtensibleKinematic = false;

        return transformInfo;
    }