Esempio n. 1
0
    void TriggerPressed(object sender, ControllerInteractionEventArgs e)
    {
        if (dragState == State.Locked)
        {
            return;
        }
        GameObject controller = VRTK_DeviceFinder.GetActualController(((VRTK_ControllerEvents)sender).gameObject);

        if (bodyPhysics.OnGround())
        {
            currentUsedController       = controller;
            controllerDragStartLocalPos = currentUsedController.transform.localPosition;
            playAreaDragStartPos        = playArea.position;
            bodyPhysics.ResetFalling();
            bodyPhysics.TogglePreventSnapToFloor(true);
            bodyPhysics.enableBodyCollisions = false;
            bodyPhysics.ToggleOnGround(false);
            dragState = State.Active;
        }
    }
Esempio n. 2
0
    protected virtual void Release(GameObject actualController)
    {
        if (actualController == mPullingController)
        {
            BodyPhysics.ResetFalling();
            mIsPulling = false;

            // Jumping
            Vector3 jumpVector = -mPullingVelocity;
            if (BodyPhysics.OnGround())
            {
                if (jumpVector.y > JumpYThreshold)
                {
                    BodyPhysics.ApplyBodyVelocity(jumpVector * JumpForceFactor, true, true);
                }
            }

            mPullingController = null;
        }
    }
Esempio n. 3
0
 private bool OnGround()
 {
     return(VRTK_bodyPhysics.OnGround());
 }