Ejemplo n.º 1
0
    void FixedUpdate()
    {
        // Vector3 move = Vector3.ClampMagnitude(new Vector3(-Input.GetAxis("Horizontal"), Input.GetAxis("OtherVertical"), Input.GetAxis("Vertical")), 1f);
        Vector3 move = Vector3.ClampMagnitude(new Vector3((Input.GetKey(KeyCode.A) ? 1 : 0) + (Input.GetKey(KeyCode.D) ? -1 : 0),
                                                          (Input.GetKey(KeyCode.Space) ? 1 : 0) + (Input.GetKey(KeyCode.LeftShift) ? -1 : 0),
                                                          (Input.GetKey(KeyCode.W) ? 1 : 0) + (Input.GetKey(KeyCode.S) ? -1 : 0)), 1);
        Vector3 turn = new Vector3(-8.5f * Input.GetAxis("Mouse Y"), -8.5f * Input.GetAxis("Mouse X"), 3 * Input.GetAxis("Spin"));

        trans.localToWorld = trans.localToWorld * Rot4.FromTangentStereographic(move, turn, Time.fixedDeltaTime);
    }