Hi everyone, i cannot work this out...
I have many spheres in my game, i have a sphere at my cursor and i want to make this sphere match the same size as another sphere in my game when it collides with them.
I have made my spheres in blender3d and they are all scaled to the same scale ( 1, 1, 1 ) in the editor, but visibly they are different in size. So I cannot easily just copy the scale over.
How do i find the true size/scale of another sphere gameobject and then resize it to match its collided sphere object?
this is what i have so far but its not working...
void OnTriggerEnter(Collider other) {
Debug.Log ("Trigger collidied with: "+ other.gameObject.name.ToString());
if ( other.gameObject.tag == "takesize")
{
this.transform.localScale = new Vector3 (other.transform.localScale.x,this.transform.localScale.y ,this.transform.localScale.z);
}
}
Thanks for your help!
J.
↧