Exemple #1
0
    void Start()
    {
        rotInfo       = new RotationInformation();
        rotInfo.valid = true;
        gameManager   = FindObjectOfType <GameManager>();

        if (GameSettings.enableGhost)
        {
            currentGhost = Instantiate(ghost, new Vector3(transform.position.x, transform.position.y), new Quaternion());
            ghostRig     = currentGhost.transform.GetChild(0);


            UpdateGhost();
        }
    }
    // Update is called once per frame
    void Update()
    {
        GameObject          go = GameObject.Find("OVRCameraRig");         // Find the game object with the script
        RotationInformation cs = go.GetComponent <RotationInformation>(); // identify the script

        angle = cs.yAngle;                                                // get the variable I want
        m     = cs.m;                                                     // get multiplier from central script

        float  yAngleRad = (Mathf.PI / 180) * angle * m;
        double sinAngle  = Mathf.Sin(angle);
        double cosAngle  = Mathf.Cos(angle);

        xPos = (float)(radius * sinAngle);
        yPos = (float)(radius * cosAngle);
        Vector3 tempVect = new Vector3(xPos, yPos);

        tempVect = tempVect.normalized * Time.deltaTime;
        rb.MovePosition(transform.position + tempVect);
    }