Collision.collider returns wrong object

Hi, all,

I just encountered a weird Physics problem, I don’t know if this is by design, so I would appreciate it if someone could tell me the definite answer.

Say, I have a hierarchy like this, a root object with two child objects;

+ Root (Kinematic Rigidbody)
--+ Core  (Sphere collider)
--+ Platform (Box collider)

and when I drop another cube with rigidbody+collider on the Core, I check the info passed by OnCollisionEnter(Collision),

it was

Collision.collider : Platform  <-- should be Core
Collision.gameObject : Root
Collision.transform : Root

Everything will be right if I put rigidbody on both the Core & Platform.

Is it a bug?

Env: Unity 4.5.2f1 + Win7

You can get the collider object by a tag or by name.
Then call void OnCollisionEnter(Collision collision) method.

Now the Script should be like this:

void OnCollisionEnter(Collision collision) {
if(collision.tag =="otherGameObjectTag"){
do some stuff here
}
if(collision.name =="otherGameObjectName"){
do some stuff here
}
}

Hope this will work