Get GameObject height for stacking

Hi everyone. I’m making a setup scene where the player has to build their base before the game starts (i.e. Rampart). I created prefabs for the different walls and want to detect when a collision takes place between two pieces, then raise the collider piece above the other. I figured I could do this by simply:

function OnCollisionEnter(col:Collider){
     if(col.gameObject.tag == "piece"){
        col.transform.position.y = theHeightOfTheObjectCollidedWith + .1;

}

But how do I find the height of theHeightOfTheObjectCollidedWith?

BTW I wrote this on my Blackberry so excuse any typos.

You can have the height locally with collider.bounds.extents.y. To have it in world space, add transform.position.y to it, assuming there isn’t any rotation. Please use the comments when you want to comment. I think I sound rude when I say that sort of thing in english, don’t know why. Not my intention :wink: