Reputation: 744
I've got following hierarchy:
The marked item has a Collider, which gets hit by a raycast. How can I access from the ColliderComponent of the Cylinder upwards to "fass1"?
RaycastHit e;
[...]
e.collider.???
Upvotes: 2
Views: 67
Reputation: 6169
If the Cylinder89 object is your e.collider
, accessing fass1's Collider can be done with:
e.collider.transform.parent.parent.GetComponent<Collider>();
Upvotes: 2