BeginEstimatingVelocity() public method

public BeginEstimatingVelocity ( ) : void
return void
    void OnAttachedToHand(VRHand hand)
    {
        attached = true;

        hand.HoverLock(null);

        Rigidbody rb = GetComponent <Rigidbody>();

        rb.isKinematic   = true;
        rb.interpolation = RigidbodyInterpolation.None;

        velocityEstimator.BeginEstimatingVelocity();
    }
        public override void OnInteract(XRNode hand, GameObject handObject = null, AnimationController handAnimation = null, XRNodeHandController handController = null)
        {
            inUse = true;

            currentHandController = handController;
            currentHandAnimation  = handAnimation;

            this.transform.SetParent(handObject.transform.parent);
            rb.isKinematic = true;

            VelocityEstimator estimator = this.GetComponent <VelocityEstimator>();

            if (estimator == null)
            {
                estimator = this.gameObject.AddComponent <VelocityEstimator>();
            }
            estimator.BeginEstimatingVelocity();

            if (dataReader != null)
            {
                dataReader.ApplyData(hand, currentHandAnimation, currentHandController);
            }

            OnGrab.Invoke();
        }
示例#3
0
 public virtual void PickupObject(Transform pickupParent)
 {
     rb.isKinematic = true;
     rb.useGravity  = false;
     pickedUp       = true;
     vEstimator.BeginEstimatingVelocity();
     transform.parent = pickupParent;
 }
示例#4
0
    //-------------------------------------------------
    protected virtual void OnAttachedToHand(Hand hand)
    {
        hadInterpolation = this.rigidbody.interpolation;

        attached = true;

        onPickUp.Invoke();

        hand.HoverLock(null);

        rigidbody.interpolation = RigidbodyInterpolation.None;

        if (velocityEstimator != null)
        {
            velocityEstimator.BeginEstimatingVelocity();
        }
    }
示例#5
0
 void Start()
 {
     ownCollider = GetComponent <CapsuleCollider>();
     rb          = GetComponent <Rigidbody>();
     ve          = GetComponent <VelocityEstimator>();
     ve.BeginEstimatingVelocity();
     BeginDirection();
 }
示例#6
0
    /// <summary>
    /// Recursively checks if ring has neighbours on either side and if they are attached to hand. Attaches if not yet attached
    /// </summary>
    /// <param name="hand"></param>
    void OnAttachedToHand(Hand hand)
    {
        // if the neighbours are already attached. the only guaranteed attach is the one a hand grabs directly
        attachedHand = hand;

        if (fishTank.ringsUseSpringConstraints)
        {
            // something
        }
        else
        {
            var attachmentFlags = Hand.AttachmentFlags.ParentToHand | Hand.AttachmentFlags.DetachFromOtherHand;
            if (dockedToAcceptor)
            {
                if (!partnerAcceptor.GetComponent <Ring>().attachedHand)
                {
                    hand.AttachObject(partnerAcceptor, attachmentFlags);
                }
                if (fishTank.gameSettingsManager.grabSplitStack)
                {
                    // if it's the end one then we don't want to attach anymore
                    if (partnerDonor)
                    {
                        if (GetFurthestGo(partnerAcceptor, partnerDonor, partnerAcceptor.GetComponent <Ring>().attachedHand.gameObject) == partnerAcceptor)
                        {
                            hand.AttachObject(partnerAcceptor, attachmentFlags);
                        }
                    }
                }
            }
            if (dockedToDonor)
            {
                if (!partnerDonor.GetComponent <Ring>().attachedHand)
                {
                    hand.AttachObject(partnerDonor, attachmentFlags);
                }
                if (fishTank.gameSettingsManager.grabSplitStack)
                {
                    // if it's the end one then we don't want to attach anymore
                    if (partnerAcceptor)
                    {
                        if (GetFurthestGo(partnerAcceptor, partnerDonor, partnerDonor.GetComponent <Ring>().attachedHand.gameObject) == partnerDonor)
                        {
                            hand.AttachObject(partnerDonor, attachmentFlags);
                        }
                    }
                }
            }
            foreach (var ao in hand.AttachedObjects)
            {
                ao.attachedObject.SetActive(true);
            }
        }
        velocityEstimator.BeginEstimatingVelocity();
    }
示例#7
0
    protected virtual void OnAttachedToHand(Hand hand)
    {
        hand.HoverLock(null);

        rigidbody.interpolation = RigidbodyInterpolation.None;

        if (velocityEstimator != null)
        {
            velocityEstimator.BeginEstimatingVelocity();
        }
    }
示例#8
0
 public void Collided()
 {
     print("Collideed");
     ve.FinishEstimatingVelocity();
     velocity      = ve.GetVelocityEstimate();
     stickvelocity = velocity.magnitude;
     if (stickvelocity < 0)
     {
         stickvelocity = stickvelocity * -1;
     }
     ve.BeginEstimatingVelocity();
 }
示例#9
0
    // Use this for initialization

    void Start()
    {
        ownCollider = GetComponent <CapsuleCollider>();
        rb          = GetComponent <Rigidbody>();
        ve          = GetComponent <VelocityEstimator>();
        hj          = GetComponent <HingeJoint>();
        print("HINGE JOINT: " + hj.name);
        hj.connectedBody = hand.GetComponent <Rigidbody>();
        print("Hand Position : x" + hand.transform.position.x + ", y" + hand.transform.position.y + ", z" + hand.transform.position.z);
        transform.position = hand.transform.position;

        ve.BeginEstimatingVelocity();
    }
示例#10
0
    void OnTriggerEnter(Collider other)
    {
        if (other.name == "Box")
        {
            velocityEstimator.BeginEstimatingVelocity();
            hitNote = null;

            mainManager.Vibrate(Controller, device);

            _Sliced hull = other.gameObject.Slice(cutPlane.transform.position, cutPlane.transform.up, crossMat);

            if (hull != null)
            {
                hull.CreateLowerHull(other.gameObject, crossMat);
                hull.CreateUpperHull(other.gameObject, crossMat);
            }

            Component[] objs = other.gameObject.transform.parent.GetComponents(typeof(Component)); //Remove Scripts
            foreach (Component comp in objs)
            {
                if (comp.GetType() == typeof(NoteJump))
                {
                    hitNote = comp as NoteJump;

                    if (hitNote.note._type == handColor)
                    {
                        hitSpeed = velocityEstimator.speed;

                        if (correctHit(hitNote.note._cutDirection))
                        {
                            mainManager.gameManager.UpdateScore(false);
                        }
                        else
                        {
                            //Play a wrong hit sound here
                            mainManager.gameManager.UpdateScore(true);
                        }
                    }
                    else
                    {
                        //Play a wrong hit sound here
                        mainManager.gameManager.UpdateScore(true);
                    }

                    hitNote.gameObject.SetActive(false);
                }
            }
        }
    }
示例#11
0
    public void Collided()
    {
        ve.FinishEstimatingVelocity();

        velocity      = ve.GetVelocityEstimate();
        stickvelocity = velocity.magnitude;
        if (stickvelocity < 0)
        {
            stickvelocity = stickvelocity * -1;
        }
        Debug.Log("Velocity: " + stickvelocity);
        ve.BeginEstimatingVelocity();

        hand.controller.TriggerHapticPulse(400);
    }
    private void Update()
    {
        //velocityEstimator.FinishEstimatingVelocity();

        if (checkInput())
        {
            Debug.Log("Triggered");
            //Select or Deselect
            if (pickedUp == null)
            {
                if (tryGetNearestFrame(out TextureBasedFrameBehaviour f))
                {
                    pickedUp = f;

                    f.transform.SetParent(transform);
                    f.transform.localPosition = Vector3.zero;
                    f.transform.localRotation = Quaternion.identity;

                    positionner.notifyFrameLift(f);

                    velocityEstimator.BeginEstimatingVelocity();
                }
            }
            else
            {
                pickedUp.transform.SetParent(null);
                positionner.notifyFrameDropped(pickedUp);
                pickedUp = null;
                velocityEstimator.FinishEstimatingVelocity();
            }
        }

        if (pickedUp != null)
        {
            positionner.notifyFrameHandled(pickedUp);

            if (checkIfHit() && detectFrameHit)
            {
                //Hit frame
                sender?.hitFrame(pickedUp.frameID);
            }
        }

        //if(myInput.getTriggerPress(VRInteractionProfileManager.FRAME_PROFILE) && pickedUp != null)
        //{
        //}
    }
示例#13
0
    // Use this for initialization
    void Start()
    {
        controllerInHand  = Controller.GetComponent <SteamVR_TrackedObject>();
        velocityEstimator = ControllerTip.GetComponent <VelocityEstimator>();
        velocityEstimator.BeginEstimatingVelocity();
        if (mainManager._currentControllers == null)
        {
            mainManager._currentControllers = new List <controller>();
        }

        if (mainManager._currentControllers.Count >= 2)
        {
            return;
        }

        mainManager._currentControllers.Add(this);
    }
示例#14
0
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //Throwing-Functionality
    //-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    public void setGrabbed()
    {
        isGrabbed = true;

        /*
         * if (isRecoveringFromThrow)
         *  isRecoveringFromThrow = false;
         */

        velocityEstimator.BeginEstimatingVelocity();
        rigidbody.useGravity = false;
        //rigidbody.isKinematic = true;

        if (navAgent != null)
        {
            navAgent.enabled = false;
        }
    }
示例#15
0
    protected override void OnAttachedToHand(Hand hand)
    {
        base.OnAttachedToHand(hand);
        //Debug.Log("<b>[SteamVR Interaction]</b> Pickup: " + hand.GetGrabStarting().ToString());

        //hadInterpolation = this.rigidbody.interpolation;

        attached = true;

        //onPickUp.Invoke();

        //hand.HoverLock(null);

        // rigidBody.interpolation = RigidbodyInterpolation.None;

        velocityEstimator.BeginEstimatingVelocity();

        //attachTime = Time.time;
        //attachPosition = transform.position;
        // attachRotation = transform.rotation;
    }
示例#16
0
 private void Awake()
 {
     velocityEstimator = ControllerTip.GetComponent <VelocityEstimator>();
     velocityEstimator.BeginEstimatingVelocity();
 }
示例#17
0
 void Start()
 {
     ve = GetComponent <VelocityEstimator>();
     ve.BeginEstimatingVelocity();
 }
示例#18
0
 void OnAttachedToHand()
 {
     dimerAttached = true;
     velEst.BeginEstimatingVelocity();
 }