Exemplo n.º 1
0
 private void RaiseOrLower()
 {
     if (Input.GetKey(KeyCode.Q))
     {
         MoveTarget.Translate(Vector3.down * speed * Time.deltaTime, Space.World);
     }
     else if (Input.GetKey(KeyCode.E))
     {
         MoveTarget.Translate(Vector3.up * speed * Time.deltaTime, Space.World);
     }
 }
Exemplo n.º 2
0
    private void UpdateMovement()
    {
        float translation = Input.GetAxis("Vertical") * speed;
        float straffe     = Input.GetAxis("Horizontal") * speed;

        translation *= Time.deltaTime;
        straffe     *= Time.deltaTime;

        Vector3 moveDir = new Vector3(straffe, 0, translation);

        MoveTarget.Translate((RotTarget.rotation * moveDir).SetY(0), Space.World);

        if (Input.GetKeyDown("escape"))
        {
            Cursor.lockState = CursorLockMode.None;
        }
    }