private void OnHandPointerGripRelease(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { this.lastGripReleaseTimeStamp = kinectHandPointerEventArgs.HandPointer.TimestampOfLastUpdate; if (this.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; this.lastGripState = GripState.Released; this.DoTransformAnimations(); if (this.scrollViewerInertiaScroller.AnimationState != AnimationState.Inertial) { if (this.AttemptInertialScroll()) { return; } } if (this.scrollViewerInertiaScroller.SlowEnoughForSelection) { kinectHandPointerEventArgs.HandPointer.Capture(null); } } gripStatus = "U"; }
private void HandleHandPointerGrip(HandPointer handPointer) { if (handPointer == null) { return; } if (this.capturedHandPointer != handPointer) { if (handPointer.Captured == null) { // Only capture hand pointer if it isn't already captured handPointer.Capture(this); } else { // Some other control has capture, ignore grip return; } } this.lastGripState = GripState.Gripped; this.lastGripTimeStamp = handPointer.TimestampOfLastUpdate; this.scrollViewerInertiaScroller.Stop(); this.gripPoint = handPointer.GetPosition(this); this.startingScrollOffset = new Point(this.HorizontalOffset, this.VerticalOffset); }
public void updateState() { if (handTracked == HandID.left) { float squeezeValue = OVRInput.Get(OVRInput.Axis1D.PrimaryHandTrigger); if (squeezeValue > 0.5f) { currentState = GripState.closed; } else { currentState = GripState.open; } } else if (handTracked == HandID.right) { float squeezeValue = OVRInput.Get(OVRInput.Axis1D.SecondaryHandTrigger); if (squeezeValue > 0.5f) { currentState = GripState.closed; } else { currentState = GripState.open; } } }
// CONTROL public void ResetGripToOpen() { grip = 0.0f; fingerAController.ForceOpen(transform); fingerBController.ForceOpen(transform); gripState = GripState.Fixed; }
public override void OnGraspedExit(Player arg_player) { m_enu_state = GripState.Neutoral; base.OnGraspedExit(arg_player); SetAbleGrasp(true); SetAbleRelease(false); arg_player.RigidbodyComponent.isKinematic = false; }
public void SetGripState(GripState state) { if (m_CurrentGripState != state) { ControllerStyle style = ControllerGeometry.Style; if (style != ControllerStyle.InitializingSteamVR && style != ControllerStyle.None && style != ControllerStyle.Unset) { bool manuallyAnimateGrips = (style == ControllerStyle.Vive || style == ControllerStyle.Wmr); switch (state) { case GripState.Standard: if (manuallyAnimateGrips) { ControllerGeometry.LeftGripMesh.transform.localPosition = Vector3.zero; ControllerGeometry.RightGripMesh.transform.localPosition = Vector3.zero; } ControllerGeometry.LeftGripMesh.material = ControllerGeometry.BaseGrippedMaterial; ControllerGeometry.RightGripMesh.material = ControllerGeometry.BaseGrippedMaterial; break; case GripState.ReadyToGrip: if (manuallyAnimateGrips) { ControllerGeometry.LeftGripMesh.transform.localPosition = m_ControllerGeometry.LeftGripPopOutVector; Vector3 vRightPopOut = m_ControllerGeometry.LeftGripPopOutVector; vRightPopOut.x *= -1.0f; ControllerGeometry.RightGripMesh.transform.localPosition = vRightPopOut; } ControllerGeometry.LeftGripMesh.material = m_ControllerGeometry.GripReadyMaterial; ControllerGeometry.RightGripMesh.material = m_ControllerGeometry.GripReadyMaterial; ControllerGeometry.LeftGripMesh.material.SetColor("_Color", m_Tint); ControllerGeometry.RightGripMesh.material.SetColor("_Color", m_Tint); break; case GripState.Gripped: if (manuallyAnimateGrips) { ControllerGeometry.LeftGripMesh.transform.localPosition = m_ControllerGeometry.LeftGripPopInVector; Vector3 vRightPopIn = m_ControllerGeometry.LeftGripPopInVector; vRightPopIn.x *= -1.0f; ControllerGeometry.RightGripMesh.transform.localPosition = vRightPopIn; } ControllerGeometry.LeftGripMesh.material = m_ControllerGeometry.GrippedMaterial; ControllerGeometry.RightGripMesh.material = m_ControllerGeometry.GrippedMaterial; ControllerGeometry.LeftGripMesh.material.SetColor("_Color", m_Tint); ControllerGeometry.RightGripMesh.material.SetColor("_Color", m_Tint); break; } } } m_CurrentGripState = state; }
private void _onHandPointerGripRelease(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (element.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; this.lastGripStatus = GripState.Released; OnHandPointerGripRelease(kinectHandPointerEventArgs.HandPointer, gripPoint, kinectHandPointerEventArgs.HandPointer.GetPosition(element)); } }
private void OnHandPointerLostCapture(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (this.capturedHandPointer == kinectHandPointerEventArgs.HandPointer) { this.capturedHandPointer = null; this.lastGripStatus = GripState.Released; kinectHandPointerEventArgs.Handled = true; } }
// CONTROL public void ResetGripToOpen() { grip = 0.0f; UpdateFingersForGrip(); fingerA.transform.localPosition = fingerAOpenPosition; fingerB.transform.localPosition = fingerBOpenPosition; gripState = GripState.Fixed; }
/// <summary> /// Initializes a new instance of the KinectScrollViewer class. /// </summary> public KinectScrollViewer() { this.SetScrollBarVisualState("Stopped"); this.lastGripState = GripState.Released; this.ClipToBounds = true; if (!IsInDesignMode) { this.InitializeKinectScrollViewer(); } }
private void OnHandPointerLostCapture(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (this.capturedHandPointer == kinectHandPointerEventArgs.HandPointer) { this.capturedHandPointer = null; this.lastGripState = GripState.Released; this.scrollMoveTimer.Start(); kinectHandPointerEventArgs.Handled = true; this.DoTransformAnimations(); } }
public override void OnGraspedEnter(Player arg_player) { m_enu_state = GripState.ENTER; SetAbleGrasp(false); SetAbleRelease(false); //新しい音でございます AudioManager.Instance.QuickPlaySE("SE_PlayerHand_grab"); arg_player.RigidbodyComponent.velocity = Vector2.zero; m_enu_state = GripState.ENTER; }
public ValorAjustavel() { InitializeComponent(); this.lastGripState = GripState.Released; // Create KinectRegion binding this.kinectRegionBinder = new KinectRegionBinder(this); this.kinectRegionBinder.OnKinectRegionChanged += this.OnKinectRegionChanged; if (!IsInDesignMode) { this.InitializeKinectButtonBase(); } }
public DragDropElement() { lastGripState = GripState.Released; kinectRegionBinder = new KinectRegionBinder(this); kinectRegionBinder.OnKinectRegionChanged += OnKinectRegionChanged; KinectRegion.AddHandPointerEnterHandler(this, OnHandPointerEnter); KinectRegion.AddHandPointerMoveHandler(this, OnHandPointerMove); KinectRegion.AddHandPointerGotCaptureHandler(this, OnHandPointerCaptured); KinectRegion.AddHandPointerLostCaptureHandler(this, OnHandPointerLostCapture); KinectRegion.AddHandPointerGripHandler(this, OnHandPointerGrip); KinectRegion.AddHandPointerGripReleaseHandler(this, OnHandPointerGripRelease); KinectRegion.AddQueryInteractionStatusHandler(this, OnQueryInteractionStatus); }
private void OnHandPointerPress(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (this.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; if (this.scrollViewerInertiaScroller.AnimationState == AnimationState.Inertial && kinectHandPointerEventArgs.HandPointer.IsInteractive) { // release capture on a press event if we're in the middle of inertial scrolling kinectHandPointerEventArgs.HandPointer.Capture(null); this.lastGripState = GripState.Released; this.scrollViewerInertiaScroller.Stop(); } } }
private void OnHandPointerMove(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (element.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; if (this.lastGripStatus == GripState.Released) { return; } if (!kinectHandPointerEventArgs.HandPointer.IsInteractive) { this.lastGripStatus = GripState.Released; } } }
public override void OnGraspedStay(Player arg_player) { arg_player.RigidbodyComponent.isKinematic = true; if (m_enu_state == GripState.ENTER) { if (!arg_player.PlayableArm.IsUsing()) { SetAbleRelease(true); m_enu_state = GripState.STAY; } } else if (m_enu_state == GripState.STAY) { arg_player.PlayableArm.TopPosition = this.transform.position; arg_player.PlayableArm.BottomPosition = this.transform.position; } }
private void HandleHandPointerGrip(HandPointer handPointer) { if (handPointer == null) { return; } if (this.capturedHandPointer != handPointer) { if (handPointer.Captured == null) { handPointer.Capture(element); } else { return; } } this.lastGripStatus = GripState.Gripped; this.gripPoint = handPointer.GetPosition(element); }
private void OnHandPointerMove(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { if (this.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; var currentPosition = kinectHandPointerEventArgs.HandPointer.GetPosition(this); this.sampleTracker.AddSample(currentPosition.X, currentPosition.Y, kinectHandPointerEventArgs.HandPointer.TimestampOfLastUpdate); this.lastTimeStamp = kinectHandPointerEventArgs.HandPointer.TimestampOfLastUpdate; if (this.lastGripState == GripState.Released) { return; } if (this.scrollViewerInertiaScroller.AnimationState == AnimationState.Inertial) { this.scrollViewerInertiaScroller.Stop(); } if (!kinectHandPointerEventArgs.HandPointer.IsInteractive) { if (this.AttemptInertialScroll()) { this.lastGripState = GripState.Released; return; } } var diffVector = this.gripPoint - currentPosition; var horizontalScaleOrigin = 0.0; var verticalScaleOrigin = 0.0; this.horizontalScale = 1.0; this.verticalScale = 1.0; this.horizontalTranslation = 0.0; this.verticalTranslation = 0.0; const double EaseFactor = 1.0 / HorizontalTranslationMax; if (this.HorizontalScrollBarVisibility != ScrollBarVisibility.Disabled) { var scrollOffset = diffVector.X + this.startingScrollOffset.X; this.ScrollToHorizontalOffset(scrollOffset); if (scrollOffset < 0) { var easedOutTranslation = Math.Tanh(-scrollOffset * EaseFactor) * HorizontalTranslationMax; horizontalScaleOrigin = this.ActualWidth; this.horizontalTranslation = easedOutTranslation; } else if (scrollOffset > this.ScrollableWidth) { var easedOutTranslation = Math.Tanh((this.ScrollableWidth - scrollOffset) * EaseFactor) * HorizontalTranslationMax; this.horizontalTranslation = easedOutTranslation; } if (Math.Abs(this.horizontalTranslation) > double.Epsilon) { this.horizontalScale = 1.0 - (HorizontalScaleDownMax * (Math.Abs(this.horizontalTranslation) / HorizontalTranslationMax)); } } if (this.VerticalScrollBarVisibility != ScrollBarVisibility.Disabled) { var scrollOffset = diffVector.Y + this.startingScrollOffset.Y; this.ScrollToVerticalOffset(scrollOffset); if (scrollOffset < 0) { this.verticalTranslation = Math.Min(-scrollOffset, VerticalTranslationMax); verticalScaleOrigin = this.ActualHeight; } else if (scrollOffset > this.ScrollableHeight) { this.verticalTranslation = Math.Max(this.ScrollableHeight - scrollOffset, -VerticalTranslationMax); } if (Math.Abs(this.verticalTranslation) > double.Epsilon) { this.verticalScale = 1.0 - (VerticalScaleDownMax * (Math.Abs(this.verticalTranslation) / VerticalTranslationMax)); } } if (this.scrollContentPresenter != null) { if (this.HasTransform()) { var transformGroup = new TransformGroup(); this.translateTransform = new TranslateTransform(this.horizontalTranslation, this.verticalTranslation); this.scaleTransform = new ScaleTransform( this.horizontalScale, this.verticalScale, horizontalScaleOrigin, verticalScaleOrigin); transformGroup.Children.Add(this.translateTransform); transformGroup.Children.Add(this.scaleTransform); this.scrollContentPresenter.RenderTransform = transformGroup; } else { this.scrollContentPresenter.RenderTransform = Transform.Identity; } } } }
private void Grip() { this.lastGripState = GripState.Gripped; }
private void Grip() { Console.WriteLine("Grip"); this.lastGripState = GripState.Gripped; }
public AbstractKinectFramesHandler(UIElement element, bool isRegisterAllFrameReady = true) { this.lastGripStatus = GripState.Released; this.element = element; this.isRegisterAllFrameReady = isRegisterAllFrameReady; }
private void OnHandPointerGripRelease(object sender, HandPointerEventArgs kinectHandPointerEventArgs) { this.lastGripReleaseTimeStamp = kinectHandPointerEventArgs.HandPointer.TimestampOfLastUpdate; if (this.Equals(kinectHandPointerEventArgs.HandPointer.Captured)) { kinectHandPointerEventArgs.Handled = true; this.lastGripState = GripState.Released; this.DoTransformAnimations(); if (this.scrollViewerInertiaScroller.AnimationState != AnimationState.Inertial) { if (this.AttemptInertialScroll()) { return; } } if (this.scrollViewerInertiaScroller.SlowEnoughForSelection) { kinectHandPointerEventArgs.HandPointer.Capture(null); } } }
/*UNUSED*/ public void OpenGrip() { /* Changes gripState so that the fingers open */ gripState = GripState.Opening; }
public void CloseGrip() { /* Changes gripState so that the fingers close */ gripState = GripState.Closing; }
private void ReleaseGrip() { this.lastGripState = GripState.Released; }
private void ReleaseGrip() { Console.WriteLine("Release"); this.lastGripState = GripState.Released; }
public void FixGrip() { /* Changes gripState so that the fingers close */ gripState = GripState.Fixed; }
public float getScaleDelta(GripState other) { return((current - other.current).magnitude - (start - other.start).magnitude); }
// -------------------------------------------------------------------------------------------- // // Unity Events // -------------------------------------------------------------------------------------------- // void Awake() { m_CurrentGripState = GripState.Standard; }
//Momento both hands public HandState(HandID hand) { handTracked = hand; currentState = GripState.open; }