Beispiel #1
0
    private void DoObjectGrab(object sender, VRTK.InteractableObjectEventArgs e)
    {
        //Debug.Log(e.interactingObject.name);

        //移動、回転、拡縮のconstraintをrigidbodyに適用
        RigidbodyConstraints constraint = RigidbodyConstraints.None;

        if (moveConstraint || type == eNodeType.FK)
        {
            constraint |= RigidbodyConstraints.FreezePosition;
        }
        if (rotateConstraint)
        {
            constraint |= RigidbodyConstraints.FreezeRotation;
        }
        targetRigidbody.constraints = constraint;
        //Debug.Log(targetRigidbody.name);

        //Grabする前のtransformを記録しておく
        savedPosition   = followTarget.localPosition;
        savedQuaternion = followTarget.localRotation;
        savedScale      = followTarget.localScale;

        if (generateNodes.RecordAllChildObjects)
        {
            generateNodes.RecordAllGrab();
        }


        grabbing = true;
    }