Place any object on floor

Hi all,

I thought this would be simple.
Simply use a ray cast find hit.distance and move the object y by that amount.
But it doesn’t seem that simple. I get lots of issues with box colliders/spheres etc. etc. Essentially I just want to place any collider object on the floor. Have looked at collider.size/extents/bounds etc. but can’t work out which is correct - though none seem to to work. I am sure this is simple and I am missing something; so any help appreciated.
Also not sure if the export (or use .blend) is correct. As the confusion over how to export so the axis are correct seems to be the long living problem :-). i.e. I am guessing z/y up is perhaps a problem causing my issue???

Cheers

Hmm, that's rather tricky in that case, but I think it might be simpler to use a mesh collider and move the object towards the floor until a collison is detected - meaning the object has come in contact with the floor. You could do something like this:

var HitFloor : boolean = false;
var MoveSpeed : float = 3;

function Update () {

   if(!HitFloor) 
   {
   //Didn't work using transform.position for some reason - works fine with addforce..
   rigidbody.AddForce(0, -5, 0);

   }
}

function OnCollisionEnter (Col : Collision) {

   if(Col.gameObject.name == "floor")
   {

   HitFloor = true;

   }
}

Seems good.
Thanks!!!

Much appreciated!