Gravity without character controller


I'm creating a simple 2D platform and i'm using a character controller and the first person control script. Could someone please say me if theres a way to apply gravity and left right movement to an object. I also tried with a rigidbody attached to my object an checked gravity but that didn't work..

Thank you

This script is not use character controller.
You want the have gravity, you can add the rigidbody in you character


enum TraXYZ {XY,XZ}
var TraXYZ : TraXYZ = TraXYZ.XY;

var moveSpeed = 6.0;
var rotateSpeed = 7.0;

function FixedUpdate() 
    if(TraXYZ == TraXYZ.XY)
        var vector3MoveXY = Vector3(Input.GetAxis("Horizontal"), 0, 0);
        transform.Translate(vector3MoveXY * moveSpeed * Time.deltaTime, Space.World);
        var vector3MoveXZ = Vector3(0, 0, Input.GetAxis("Vertical"));
        transform.Translate(vector3MoveXZ * moveSpeed * Time.deltaTime, Space.World);
    if (this.rigidbody)
        rigidbody.freezeRotation = true;

@script RequireComponent(CapsuleCollider)
@script RequireComponent(Rigidbody)

I am use this script too. So it is work.