// Update is called once per frame
    void Update()
    {
        device = SteamVR_Controller.Input((int)trackedObj.index);

        if (Lconrtollerflag == false)
        {
            if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x;
            }

            if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad))
            {
                touchCurrent = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x;
                distance     = touchCurrent - touchLast;
                touchLast    = touchCurrent;
                swipeSum    += distance;

                if (!hasSwipedRight)
                {
                    if (swipeSum > 0.5f)
                    {
                        swipeSum = 0;
                        SwipeRight();
                        hasSwipedRight = true;
                        hasSwipedLeft  = false;
                    }
                }

                if (!hasSwipedLeft)
                {
                    if (swipeSum < -0.5f)
                    {
                        swipeSum = 0;
                        SwipeLeft();
                        hasSwipedLeft  = true;
                        hasSwipedRight = false;
                    }
                }
            }

            if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                //Reset Swipe
                SwipeReset();
            }

            if (device.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
            {
                //Spawn object currently selected by menu
                SpawnObject();
            }

            if (device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger))
            {
                objectMenuManager.EnableDisableMenu();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        device = SteamVR_Controller.Input((int)trackedObject.index);
        if (isRight)
        {
            if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                touchLast = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x;
            }
            if (device.GetTouch(SteamVR_Controller.ButtonMask.Touchpad))
            {
                touchCurrent = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad).x;
                distance     = touchCurrent - touchLast;
                touchLast    = touchCurrent;
                swipeSum    += distance;
                if (!hasSwipedRight)
                {
                    if (swipeSum > 0.5f)
                    {
                        swipeSum = 0;
                        SwipedRight();
                        hasSwipedRight = true;
                        hasSwipedLeft  = false;
                    }
                }
                if (!hasSwipedLeft)
                {
                    if (swipeSum < -0.5f)
                    {
                        swipeSum = 0;
                        SwipedLeft();

                        hasSwipedLeft  = true;
                        hasSwipedRight = false;
                    }
                }
            }
            if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
            {
                swipeSum       = 0;
                touchCurrent   = 0;
                touchLast      = 0;
                hasSwipedLeft  = false;
                hasSwipedRight = false;
            }


            if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
            {
                //Spwan
                SpawnObject();
            }

            if (device.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
            {
                objectMenuManager.EnableDisableMenu();
            }
        }
        else
        {
            //not used!
            if (isDashing)
            {
                lerpTime += Time.deltaTime * dashSpeed;
                player.transform.position = Vector3.Lerp(dashStartPosition, teleportLocation, lerpTime);
                if (lerpTime >= 1)
                {
                    isDashing = false;
                    lerpTime  = 0;
                }
            }
            else
            {
                if (device.GetPress(SteamVR_Controller.ButtonMask.Trigger) && device.GetPress(SteamVR_Controller.ButtonMask.Axis0))
                {
                    laser.gameObject.SetActive(true);
                    teleportAimerObject.SetActive(true);


                    setLaserStart(gameObject.transform.position);
                    RaycastHit hit;
                    if (Physics.Raycast(transform.position, transform.forward, out hit, 25f, laserMask))
                    {
                        teleportLocation = hit.point;
                    }
                    else
                    {
                        teleportLocation = transform.position + 15 * transform.forward;
                        RaycastHit groundRay;
                        if (Physics.Raycast(teleportLocation, -Vector3.up, out groundRay, 17, laserMask))
                        {
                            teleportLocation.y = groundRay.point.y;
                        }
                    }
                    setLaserEnd(teleportLocation);
                    // aimer
                    teleportAimerObject.transform.position = teleportLocation + yNudgeVector;
                }

                if (device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger))
                {
                    laser.gameObject.SetActive(false);
                    teleportAimerObject.SetActive(false);
                    player.transform.position = teleportLocation;
                    //dashStartPosition = player.transform.position;
                    //isDashing = true;
                }
            }
            if (device.GetPress(SteamVR_Controller.ButtonMask.Grip))
            {
                movementDirection          = playerCam.transform.forward;
                movementDirection          = new Vector3(movementDirection.x, 0, movementDirection.z);
                movementDirection          = movementDirection * moveSpeed * Time.deltaTime;
                player.transform.position += movementDirection;
            }
        }
    }