Esempio n. 1
0
        // Update is called once per frame
        void Update()
        {
            float speed = this.speed;

            if (Input.GetKey(KeyCode.LeftShift))
            {
                speed *= 10.0f;
            }

            if (Input.GetKey(KeyCode.W))
            {
                transform.position += gameObject.transform.forward * Time.deltaTime * speed;
            }

            if (Input.GetKey(KeyCode.S))
            {
                transform.position -= gameObject.transform.forward * Time.deltaTime * speed;
            }

            if (Input.GetKey(KeyCode.A))
            {
                transform.position -= gameObject.transform.right * Time.deltaTime * speed;
            }

            if (Input.GetKey(KeyCode.D))
            {
                transform.position += gameObject.transform.right * Time.deltaTime * speed;
            }
            if (Input.GetKey(KeyCode.Q))
            {
                Roll(-Time.deltaTime * speed);
            }
            if (Input.GetKey(KeyCode.E))
            {
                Roll(Time.deltaTime * speed);
            }

            SteeringManager.PrintVector("Cam pos: ", transform.position);
            SteeringManager.PrintVector("Cam forward: ", transform.forward);

            mouseX = Input.GetAxis("Mouse X");
            mouseY = Input.GetAxis("Mouse Y");

            Yaw(mouseX);
            Pitch(-mouseY);
        }
        // Update is called once per frame
        void Update()
        {
            float mouseX, mouseY;
            float speed = this.speed;

            float runAxis = Input.GetAxis("Run Axis");

            if (Input.GetKey(KeyCode.LeftShift) || runAxis != 0)
            {
                speed *= 10.0f;
            }

            if (Input.GetKey(KeyCode.W))
            {
                Walk(Time.deltaTime * speed);
            }

            if (Input.GetKey(KeyCode.S))
            {
                Walk(-Time.deltaTime * speed);
            }

            if (Input.GetKey(KeyCode.A))
            {
                Strafe(-Time.deltaTime * speed);
            }

            if (Input.GetKey(KeyCode.D))
            {
                Strafe(Time.deltaTime * speed);
            }
            if (Input.GetKey(KeyCode.Q))
            {
                Roll(-Time.deltaTime * speed);
            }
            if (Input.GetKey(KeyCode.E))
            {
                Roll(Time.deltaTime * speed);
            }



            mouseX = Input.GetAxis("Mouse X");
            mouseY = Input.GetAxis("Mouse Y");

            GameObject ovrplayer = GameObject.FindGameObjectWithTag("ovrcamera");

            if (ovrplayer != null)
            {
                ovrplayer.transform.position = transform.position;
            }

            Yaw(mouseX);
            float contYaw   = Input.GetAxis("Yaw Axis");
            float contPitch = Input.GetAxis("Pitch Axis");

            Yaw(contYaw);

            // If in Rift mode, dont pitch
            if (!Params.riftEnabled)
            {
                Pitch(-mouseY);
                Pitch(contPitch);
            }

            float contWalk   = Input.GetAxis("Walk Axis");
            float contStrafe = Input.GetAxis("Strafe Axis");

            Walk(-contWalk * speed * Time.deltaTime);
            Strafe(contStrafe * speed * Time.deltaTime);

            SteeringManager.PrintVector("Cam pos: ", transform.position);
            SteeringManager.PrintVector("Cam forward: ", transform.forward);
        }