コード例 #1
0
ファイル: GrabRotation.cs プロジェクト: Tigerkim06/VRdentist
 void OnGrabbed(XRBaseInteractor rBaseInteractor)
 {
     //attachTransform = rBaseInteractor.attachTransform;
     attachTransform           = grabInteractable.attachTransform;
     mLocalRot_attachTransform = attachTransform.localRotation;
     xrInteractor = rBaseInteractor;
     handPresence = rBaseInteractor.attachTransform.GetComponentInChildren <HandPresence>();
 }
コード例 #2
0
 void OnReleased(XRBaseInteractor rBaseInteractor)
 {
     if (handPresence)
     {
         handPresence.showController = recordShowController;
         handPresence.showHand       = recordShowHand;
     }
     handPresence = null;
 }
コード例 #3
0
ファイル: GrabRotation.cs プロジェクト: Tigerkim06/VRdentist
 void OnReleased(XRBaseInteractor rBaseInteractor)
 {
     if (attachTransform)
     {
         attachTransform.localRotation = mLocalRot_attachTransform;
     }
     attachTransform = null;
     xrInteractor    = null;
     handPresence    = null;
 }
コード例 #4
0
 HandState CheckHandPowerState(HandPresence hand)
 {
     if (hand.SecondaryButtonPressed)
     {
         return(HandState.Force);
     }
     else if (hand.CurrentGesture == HandGesture.Pinch)
     {
         return(HandState.Fire);
     }
     else
     {
         return(HandState.Default);
     }
 }
コード例 #5
0
    HandDataPacket GetHandData(HandPresence handPresence, SpellController spellController)
    {
        HandDataPacket data = new HandDataPacket()
        {
            HandPosition    = handPresence.transform.position,
            HandRotation    = handPresence.transform.rotation,
            Trigger         = handPresence.TriggerValue,
            Grip            = handPresence.GripValue,
            Velocity        = handPresence.Velocity,
            HandState       = spellController.HandState,
            TargetHandState = spellController.TargetHandState,
            StatePower      = spellController.StatePower
        };

        return(data);
    }
コード例 #6
0
    void OnGrabbed(XRBaseInteractor rBaseInteractor)
    {
        HandPresence rHandPresence = rBaseInteractor.attachTransform.GetComponentInChildren <HandPresence>();

        if (rHandPresence)
        {
            if (handPresence && handPresence != rHandPresence)
            {
                handPresence.showController = recordShowController;
                handPresence.showHand       = recordShowHand;
            }
            handPresence                = rHandPresence;
            recordShowController        = handPresence.showController;
            recordShowHand              = handPresence.showHand;
            handPresence.showController = false;
            handPresence.showHand       = false;
        }
    }
コード例 #7
0
    internal void UpdateHandState(HandPresence controller)
    {
        TargetHandState = HandState.Default;
        if (controller.SecondaryButtonPressed)
        {
            TargetHandState = HandState.Force;
            if (HandState != HandState.Force)
            {
                if (FirePercentageCharged > 0)
                {
                    DechargePower(ref FireCharge, ref _chargeupSeconds, ref FirePercentageCharged);
                }
                else
                {
                    HandState = HandState.Force;
                }
            }
            else if (HandState == HandState.Force && ForcePercentageCharged < 1.0f)
            {
                ChargePower(ref ForceCharge, ref _chargeupSeconds, ref ForcePercentageCharged);
            }
        }


        else if (controller.CurrentGesture == HandGesture.Pinch)
        {
            TargetHandState = HandState.Fire;
            if (HandState != HandState.Fire)
            {
                if (ForcePercentageCharged > 0)
                {
                    DechargePower(ref ForceCharge, ref _chargeupSeconds, ref ForcePercentageCharged);
                }
                else
                {
                    HandState = HandState.Fire;
                }
            }
            else if (HandState == HandState.Fire && FirePercentageCharged < 1.0f)
            {
                ChargePower(ref FireCharge, ref _chargeupSeconds, ref FirePercentageCharged);
            }
        }


        else
        {
            if (ForcePercentageCharged != 0.0f)
            {
                DechargePower(ref ForceCharge, ref _chargeupSeconds, ref ForcePercentageCharged);
                //decharge force
            }
            else if (FirePercentageCharged != 0.0f)
            {
                //decharge fire
                DechargePower(ref FireCharge, ref _chargeupSeconds, ref FirePercentageCharged);
            }
            else
            {
                HandState = HandState.Default;
            }
        }

        if (HandState == HandState.Fire)
        {
            StatePower = FirePercentageCharged;
        }
        else if (HandState == HandState.Force)
        {
            StatePower = ForcePercentageCharged;
        }
    }
コード例 #8
0
 void OnReleased(XRBaseInteractor rBaseInteractor)
 {
     handPresence = null;
     grabInteractable.attachTransform.localRotation = oldPivot;
 }
コード例 #9
0
 void OnGrabbed(XRBaseInteractor rBaseInteractor)
 {
     handPresence = rBaseInteractor.GetComponentInChildren <HandPresence>();
     oldPivot     = grabInteractable.attachTransform.localRotation;
 }