I’m sure I’ve done this before, but I’m not remembering how…
I have a custom class, FooObject. Each FooObject instance has a GameObject and a BoxCollider. I’m casting a ray from one FooObject’s GameObject’s transfrom.position to see if any other FooObject’s BoxCollider is hit.
That’s all fine, but I can’t remember how to access the FooObject instance of the BoxCollider I hit with my Raycast.
I need something like:
if (hit.collider != null) {FooObject whichFoo = the FooObject that owns the collider we hit}
Any takers?
Thanks for your time…!