Using transform.position to pick up an objec

I’m trying to pick up a block and have it float above the player (think block dude for the ti 84).
This is my code now and I’m not sure what to do to fix it. I want it so that when the player is touching the block and presses the mouse button they can pick it up. The zeroes should be the players position.
using UnityEngine;
using System.Collections;

public class pickup : MonoBehaviour {
// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

}
void OnTriggerEnter(Collider col)
{
	if (col.gameObject.tag == "Player" && Input.GetButtonUp ("Fire1"))
	{
		gameObject.transform.position = Vector3(0,0,0);
	}
}

}

The problem that you are having is that OnTriggerEnter happens on the frame that the player enters tha trigger and chances are, you won’t get perfect timing with the button press.

You should also do ontriggerstay:

void OnTriggerStay( Collider col )
{

//same code as ontriggerenter in here
}

In addition to that, you are always placing the object at 0,0,0. Unless your player is always just below 0,0,0 in world coordinates, this is incorrect. What you want to do is make the player object a parent of the block after you set it to above the player:

gameObject.transform.position = new Vector3( col.gameObject.transform.position.x, col.gameObject.transform.position.y + 2, col.gameObject.transform.position.z );
gameObject.transform.parent = col.gameObject.transform;