Rotating a character with the joystick of the controller

I am currently working on a script to allow my character to move using the joystick on a xbox 360 controller. The character is moving along a plain and has the ability to move in any direction. I am trying to get my character to rotate the way that he is moving based on the orientation of the joystick. Is this possible?

Here is the code I am using to get it to move.

function Update () 

moveForward = Input.GetAxis("Vertical") * forwardBack;
moveRight = Input.GetAxis("Horizontal") * leftRight;

moveForward *= -Time.deltaTime;
moveRight *= Time.deltaTime;

character.transform.position.x += moveForward;
character.transform.position.z += moveRight;

you need a third party plug in or the xbox dev tools from unity to get access to coding for xbox 360 (legally that is)

other solution is to get some 3rd party software that lets you map an xbox controller to actual keystrokes then mapping your controller to the specific keys your are using in your unity project. In order to get your xbox controller working with your computer you need a wired controller or a wireless adapter port for 360 to pc. the Wireless adapter port will let u sync 4 controllers.

And for future reference there is a button in your questions tool bar with a picture of binary code saying


highlight all your code and use that to format it so it can be seen in a lovely code box such as this

function NeatCodePlease()
   Debug.Log ("format your question code properly")