// public void GrabStart(CustomHand hand) { // power steering stuff PowerSteeringActive = false; // SetInteractibleVariable(hand); hand.SkeletonUpdate(); hand.PivotUpdate(); Transform tempPoser = GetMyGrabPoserTransform(hand); Vector3 HandTolocalPos = transform.InverseTransformPoint(hand.PivotPoser.position); HandTolocalPos.z = 0; tempPoser.localPosition = HandTolocalPos; if (hand.handType == SteamVR_Input_Sources.LeftHand) { oldPosLeft = new Vector2(HandTolocalPos.x, HandTolocalPos.y); } else { if (hand.handType == SteamVR_Input_Sources.RightHand) { oldPosRight = new Vector2(HandTolocalPos.x, HandTolocalPos.y); } } ReversHand = Vector3.Angle(transform.forward, hand.PivotPoser.forward) < 90; Grab.Invoke(); }
public bool Interact(int x, int y, Interaction interaction) { if (pixels.Contains(new Point(x, y))) { switch (interaction) { case Interaction.Eye: Look?.Invoke(); break; case Interaction.Hand: Grab?.Invoke(); break; case Interaction.Mouth: Talk?.Invoke(); break; default: return(false); } } return(true); }
void GrabStart(CustomHand hand) { SetInteractibleVariable(hand); hand.SkeletonUpdate(); hand.grabType = CustomHand.GrabType.Select; Grab.Invoke(); }
// Assign new held Item, then grab the item into our hand / controller public void GrabGrabbable(Grabbable item) { // We are trying to grab something else if (flyingGrabbable != null && item != flyingGrabbable) { return; } // Make sure we aren't flying an object at us still resetFlyingGrabbable(); // Drop whatever we were holding if (HeldGrabbable != null && HeldGrabbable) { Debug.Log("Try release:" + HeldGrabbable.name); TryRelease(); } // Assign new grabbable HeldGrabbable = item; // Just grabbed something, no longer fresh. FreshGrip = false; Debug.Log("Grabbb in grabber: " + item.name); // Let item know it's been grabbed item.GrabItem(this); Grab?.Invoke(new GrabbableEventArgs(item, this)); }
Vector3 oldDir; //old hands rotation public void GrabStart(CustomHand hand) { SetInteractibleVariable(hand); hand.SkeletonUpdate(); GetMyGrabPoserTransform(hand).rotation = Quaternion.LookRotation(transform.forward, hand.PivotPoser.up); oldDir = transform.InverseTransformDirection(hand.PivotPoser.up); GetMyGrabPoserTransform(hand).transform.position = hand.PivotPoser.position; Grab.Invoke(); }
protected virtual void OnGrabHit(int i, bool grab) { Grab?.Invoke(i, grab); if (CanResetOntrigger && Input.GrabLState && Input.GrabRState) { Reset(); } }
public void GrabStartCustom(CustomHand hand) { Vector3 tempPosHandLocal = transform.InverseTransformPoint(hand.GrabPoint()); tempPosHandLocal.x = 0; tempPosHandLocal.y = 0; MyRigidbody.useGravity = false; MyRigidbody.isKinematic = false; MyRigidbody.maxAngularVelocity = float.MaxValue; if (tempPosHandLocal.z > clampHandlePosZ.x && tempPosHandLocal.z < clampHandlePosZ.y) { if (hand.handType == SteamVR_Input_Sources.LeftHand) { SetInteractibleVariable(hand, handleObject [0]); handleObject [0].transform.localPosition = tempPosHandLocal; } else { if (hand.handType == SteamVR_Input_Sources.RightHand) { SetInteractibleVariable(hand, handleObject [1]); handleObject [1].transform.localPosition = tempPosHandLocal; } } } else { SetInteractibleVariable(hand); } if (leftHand && rightHand) { leftIsForvard = transform.InverseTransformPoint(leftMyGrabPoser.transform.position).z > transform.InverseTransformPoint(rightMyGrabPoser.transform.position).z; LocalDirectionWithPivotLeft = leftMyGrabPoser.transform.InverseTransformDirection(transform.up); LocalDirectionWithPivotRight = rightMyGrabPoser.transform.InverseTransformDirection(transform.up); } if (pickReleaseOnce) { if (!leftHand || !rightHand) { Grab.Invoke(); //sound } } else { Grab.Invoke(); } }
public void GrabStart(CustomHand hand) { SetInteractibleVariable(hand); hand.SkeletonUpdate(); Grab.Invoke(); }
protected virtual void OnTriggerHit(int i, bool trigger) { Grab?.Invoke(i, trigger); }