void OnGrabbed(XRBaseInteractor rBaseInteractor) { //attachTransform = rBaseInteractor.attachTransform; attachTransform = grabInteractable.attachTransform; mLocalRot_attachTransform = attachTransform.localRotation; xrInteractor = rBaseInteractor; handPresence = rBaseInteractor.attachTransform.GetComponentInChildren <HandPresence>(); }
void OnReleased(XRBaseInteractor rBaseInteractor) { if (handPresence) { handPresence.showController = recordShowController; handPresence.showHand = recordShowHand; } handPresence = null; }
void OnReleased(XRBaseInteractor rBaseInteractor) { if (attachTransform) { attachTransform.localRotation = mLocalRot_attachTransform; } attachTransform = null; xrInteractor = null; handPresence = null; }
HandState CheckHandPowerState(HandPresence hand) { if (hand.SecondaryButtonPressed) { return(HandState.Force); } else if (hand.CurrentGesture == HandGesture.Pinch) { return(HandState.Fire); } else { return(HandState.Default); } }
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); }
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; } }
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; } }
void OnReleased(XRBaseInteractor rBaseInteractor) { handPresence = null; grabInteractable.attachTransform.localRotation = oldPivot; }
void OnGrabbed(XRBaseInteractor rBaseInteractor) { handPresence = rBaseInteractor.GetComponentInChildren <HandPresence>(); oldPivot = grabInteractable.attachTransform.localRotation; }