Pick Up Script RigidBody Issues

Hi, I am pretty new to Unity and I generally us C#, but I managed to get the basics of this script working using JavaScript so I’ve stuck with it.
Basically, I’ve coded a very basic pick up object script that does just that. When the player collides with the box collider trigger, it allows the player to tap the ‘e’ key and then the object becomes a child of the camera. This works just fine but gravity is still applied. I tried simply disabling it when it’s picked up but then it floats away. I then tried making it kinematic but now it pushes the player backwards…so I’m well and truly stuck.

Any solutions to this?

var theObject : GameObject; //the object to pick up
var player : UnityEngine.Camera;
var canPickUp : boolean = false; //turns true when the player is close enough to the object


function Update ()
{
        if(Input.GetKeyDown("e") && canPickUp)
        {
                theObject.transform.parent = player.transform;
                theObject.GetComponent.<Rigidbody>().isKinematic = true;
        }
}
function OnTriggerEnter (info : Collider)
{
        if(info.tag == "Player")
        {
                canPickUp = true;
        }
}
function OnTriggerExit (info : Collider)
{
        if(info.tag == "Player")
        {
                canPickUp = false;
        }
}

Any help would be greatly appreciated, thanks!

As long as it is a child of the camera, you should be able to keep it moving with the camera by setting the constraints on the rigidbody.
GetComponent().constraints = RigidbodyConstraints.FreezeAll;

or whatever constraints settings you need.