Ok, I used this simple code in a rigidbody object and the object tagged as "player" is another rigidbody (sphere) that I can roll away.
var pegou = false;
function OnTriggerStay (other : Collider) {
if(other.gameObject.tag == "mao"){
pegou = true;
}
}
function Update() {
if (pegou){
heldObject = gameObject;
heldObject.transform.parent = gameObject.FindWithTag("Player").transform;
heldObject.GetComponent(Rigidbody).isKinematic = true;
}
}
it works, the other object is parented the way it needs but I want the other rigidbody becomes part of the first object (father) at all, it means collide with the ground and change the way the fatherwalk. Is there a way??