Placing an object down

how do i make my object follow the ground? my ground is a mesh collider and id also like it to collide with my trees usinga box colider how can i achive this? atm it just floats 5 away from the main camera
ps still looking for help on the following the terrain

var player : Transform;
var ActualPlacedPeice : Transform;
function Start() 
{
     player = GameObject.Find("Player").transform;
}
function Update () 
{
	var pos = player.position + player.forward * 5.0;  
    transform.position = pos + Vector3.up * 0.5;  
    transform.rotation = Quaternion.LookRotation(player.transform.forward);  
    
    if (Input.GetButtonDown("Fire1")) 
    {
      var Build = Instantiate(ActualPlacedPeice,transform.position, transform.rotation); 
    }
    
}

So what your error message is trying to tell you is that one of your objects does not have the “position” property. In this case your problem is at line 15:

// line 9: pos is declared as a Vector3
var pos = player.position + player.forward * 5.0;

// line 15: you try to refrence a "position" and "rotation" property of pos
//     but since pos is a Vector3 it does not have these properties
var Build = Instantiate(ActualPlacedPeice,pos.position, pos.rotation); 

If you replace line 15 with this you will get past your exception:

var Build = Instantiate(ActualPlacedPeice,transform.position, transform.rotation);

I believe your problem is here:

Quaternion.LookRotation(player.transform.forward);

Player is already a transform, thus you wouldn’t do player.transform