- Home /
Question by
fortytwobricks · Oct 23, 2011 at 09:33 PM ·
collisioncollidercollisiondetection
Multiple Colliders, Single Object
Hey all,
I have an object that has a sphere collider and a capsule collider on it. I am using the capsule collider to simply detect when the player is selecting the object and do some movement code, while I want the sphere collider to handle some interactions with other things it encounters as the object moves throughout the gamespace (read the sphere represents a grav field outside my ship that picks stuff up as it travels).
some code:
void OnCollisionEnter(Collision other) {
if(other.collider.Equals(SphereCollider) && other.gameObject.CompareTag("FloatingStuff")){
Debug.Log("stuff grabbable");
}
}
So simply put how do I tell that my collision is by my sphere collider rather than the capsule one?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613020815im_/https://answers.unity.com/themes/thub/images/avi.jpg)