コード例 #1
0
ファイル: BallMovement.cs プロジェクト: darargon/Gravity-VR
    void Update()
    {
        if (activeAdjustment)
        {
            Vector3 currentPos = gameObject.transform.position;

            SphericalCoordinates sc = new SphericalCoordinates(radius, 0, 0, 1, radius + .3f, -Mathf.PI, Mathf.PI, -Mathf.PI / 2, Mathf.PI / 2);
            sc.loopPolar = true;
            sc.FromCartesian(currentPos);
            //sc.SetRadius(radius);
            float change = sign * speed * Time.deltaTime;
            if (direction == 0)
            {
                sc.RotatePolarAngle(change);
                gameObject.transform.position = sc.toCartesian;
            } else
            {
                sc.RotateElevationAngle(change);
                gameObject.transform.position = sc.toCartesian;
            }
        }
        if (Input.GetButton("R1"))
        {
            mainCam.SetActive(false);
            ballCam.SetActive(true);
        }
        else
        {
            mainCam.SetActive(true);
            ballCam.SetActive(false);
        }
    }