Scripted gravity without Rigidbody or character controller in JS

Im trying to make a gameObject fall without attaching a rigidbody or character controller. The part that Im having touble with is that the object rotates as well... I think I could use the global axis but I dont know how. this is the script that Im using.

var grounded : boolean = true; var jump : float = 250.0; var moveSpeed : float = 10.0; moveSpeed = moveSpeed/100; var turnSpeed : float = 10.0; turnSpeed = turnSpeed/100; var gravity : float = 20; var playerCamera : Transform; function Update () { transform.Rotate(Vector3(Input.GetAxis("CameraVertical")*turnSpeed, Input.GetAxis("CameraHorizontal")*turnSpeed, 0)); if (grounded == false) { //This is where I want to apply the gravity force. transform.Translate(Vector3(0, gravity*Time.deltaTime, 0)); } if (grounded == true) { transform.Translate(Vector3(Input.GetAxis("Horizontal")*moveSpeed, 0, Input.GetAxis("Vertical")*moveSpeed)); } if (Input.GetButtonDown("Jump")) { transform.Translate(Vector3(0, Input.GetButtonDown("Jump"), 0)); } } function OnCollisionEnter (other : Collision) { if (other.gameObject.tag == "Ground") { grounded = true; } else { grounded = false; } }

also Im new to Unity Answers any help as to how to post cleaned up scripts?

function Awake ()

{

//freeze physics rotation
rigidbody.freezeRotation = true;

}