Help me with my scripting

Hello, I’m a newcomer to Unity and scripting in general. Currently I’m using Java for all my scripting ATM. The game is 3D and the main player is a sphere that moves forward, back, left, right and double jumps. I’ve run into a problem with this as because it’s a sphere if I lets say move forward then left at the same time the ball rotates putting it’s whole movement off. Here’s the script I used to program the main player

#pragma strict

var rotationSpeed = 100;
var JumpHeight = 8;

private var isFalling = false;

function Update ()
{
var rotation : float = Input.GetAxisRaw (“Horizontal”) * rotationSpeed;
rotation *= Time.deltaTime;
GetComponent.().AddRelativeTorque (Vector3.back * rotation);

if (Input.GetKeyDown(KeyCode.Space) && isFalling == false)
{

GetComponent.().velocity.y = JumpHeight;
isFalling = true;
}
{
var brotation : float = Input.GetAxisRaw (“Vertical”) * rotationSpeed;
brotation *= Time.deltaTime;
GetComponent.().AddRelativeTorque (Vector3.right * brotation);
}
}

function OnCollisionStay ()
{
isFalling = false;
}

Anybody have any ideas?

I think that instead of AddRelativeTorque, you want to use the Rigidbody.AddForce function (for each key input.)

Please use code tags when posting code.