Пример #1
0
    public override void StartUsing(VRTK_InteractUse currentUsingObject = null)
    {
        base.StartUsing(currentUsingObject);


        if (StaticData.getShowScissor())
        {
            Debug.Log("start using");

            // drop the tape in hands
            base.ForceStopInteracting();
            GameObject dropped = GameObject.Find("tape_model");
            Debug.Log(dropped.transform.lossyScale);

            // change right hand gesture
            GameObject rightHand = GameObject.Find("[VRTK_SDKManager]/SDKSetups/SteamVR/[CameraRig]/Controller (right)/RightController/VRTK_BasicHand");

            VRTK_SDKTransformModify controllerTrans = rightHand.GetComponent <VRTK_SDKTransformModify>();
            if (controllerTrans.sdkOverrides != null)
            {
                // Debug.Log("Modify right hand rotation");
                // rotate right hand
                controllerTrans.enabled = false;
                controllerTrans.sdkOverrides[0].rotation = new Vector3(0.0f, 0.0f, -72.0f);
                controllerTrans.enabled = true;
            }

            // tell the system that the scissor is cut
            StaticData.setIsCut(true);

            Destroy(dropped);
        }
    }
Пример #2
0
 protected virtual void ProcessSDKTransformModify(VRTK_ControllerReference controllerReference)
 {
     if (VRTK_ControllerReference.IsValid(controllerReference))
     {
         VRTK_SDKTransformModify transformModify = (grabbedSnapHandle != null ? grabbedSnapHandle.gameObject : grabbedObject).GetComponentInChildren <VRTK_SDKTransformModify>();
         if (transformModify != null)
         {
             transformModify.UpdateTransform(controllerReference);
         }
     }
 }