How to make Headbobber on joystick Android

Hi all. I’m looking to make a headbobber on joystick mobile.

I have found this script [wiki.unity3d.com/index.php/Headbobber] 1 but i don’t have any idea to give Input.GetAxis(“Vertical”) and Input.GetAxis(“Horizontal”) because i’m using a
prefab of First Person Controls for Android mobile.

Can you give me any idea to solve this problem?

I have never used it, but reading the scripts now, FirstPersonControl.js reads inputs from Joystick.js . Joystick.js has a variable called position which is a Vector2, and stores a ± normalized value based on what is happening with the GUI and the touch.

So, on the headbob script, you start with a variable like that on the FirstPersonControl script :

var moveTouchPad : Joystick;

Drag and drop your Joystick there the same way as for the FirstPersonControl.

Now in the Update, just swap out horizontal and vertical to use the values from Joystick position (Vector2) :

// horizontal = Input.GetAxis("Horizontal"); 
horizontal = moveTouchPad.position.x; 
// vertical = Input.GetAxis("Vertical"); 
vertical = moveTouchPad.position.y;

Hi, thanks, but have a compilat error with waveslice . Could you help me with that?