Search Unity

Need help fixing first person camera

Discussion in 'Scripting' started by scr33ner, Feb 10, 2019.

  1. scr33ner

    scr33ner

    Joined:
    May 15, 2012
    Posts:
    188
    Hey all,
    I need some help in fixing the default Rigidbody First Person Controller.
    All I want to do is add joystick functionality in addition to mouse + keyboard combo.

    I've got right stick look sorted. The problem is I need to check which input device is being used when the function is called because without the check, the camera is jitters.

    I've tried this code:

    Code (CSharp):
    1.  
    2. //-----------check input source          
    3.             if ((rStick_X != 0.0) || (rStick_Y != 0.0))
    4.             {
    5.                 StickRotateView();
    6.             }
    7.             else
    8.             {
    9.                 RotateView();
    10.             }
    11. //-----------end check */
    The problem is, the camera snaps back to its last rotational FOV (where the last mouse was looking at last).

    What is the best way to fix this issue?

    Thanks in advance