1
\$\begingroup\$

How can I properly save rotation of the camera while swipe and pass it to transform.rotation = Quaternion.Slerp() start start Quaternion?
Right now after I swiped Gyro get his transform.position and I need to take the position after the swipe.

    protected void Update()
    {
        if (!using_Touch)
        {
            if (show_video)
            {
                   AttachGyro();
                show_video = false;
            }
            gyroEnabled = true;
            if (!gyroEnabled)
                return;
            if (from_touch)
            {
                transform.rotation = Quaternion.Slerp(First_position ,
cameraBase * (ConvertRotation(referanceRotation * Input.gyro.attitude) * GetRotFix()), lowPassFilterFactor);

            }
            else
            {
                transform.rotation = Quaternion.Slerp(transform.rotation,
cameraBase * (ConvertRotation(referanceRotation * Input.gyro.attitude) * GetRotFix()), lowPassFilterFactor);
            }
            from_touch = false;
        }
        int fingerCount = 0;
        foreach (Touch touch in Input.touches)
        {
            using_Touch = true;
            gyroEnabled = false;
            if (touch.phase != TouchPhase.Ended && touch.phase != TouchPhase.Canceled)
            {
                fingerCount++;


                float scalar = 0.8f;  //0.05f;
                transform.rotation = Quaternion.Slerp(transform.rotation,
    Quaternion.Euler(new Vector3(
                    transform.localEulerAngles.x + touch.deltaPosition.y * 

scalar, transform.localEulerAngles.y + touch.deltaPosition.x * scalar, transform.localEulerAngles.z)), scalar);
    //need to set it to that variable                   
    First_position = Camera.main.transform.rotation;
                    from_touch = true;

            }
            else
            {
                using_Touch = false;

            }
        } 
    }
\$\endgroup\$
1
  • \$\begingroup\$ Remember that we've never seen your game before. Please consider editing your question to include more description of what feature you're implementing, and walk us through the expected behaviour so we can understand what you need. \$\endgroup\$
    – DMGregory
    Commented Mar 12, 2018 at 13:43

0

You must log in to answer this question.

Browse other questions tagged .