- Home /
Adding child Colliders to your parent object's OnTriggerStay
Hey there,
I'm trying to make a zipline. I've already created a function that creates the path you'll travel and everything, and now I'm working on the activation. I'm using an OnTriggerStay function to detect when a player can press F to use the zipline.
However, I'm also trying to keep implementing the zipline into a scene as easy as possible, since it'll be much easier to build levels that way. So I've set it up so that you make a parent object, add the script to that, and then add child objects whose transforms get used to generate checkpoints on the zipline.
These child objects also typically contain the triggers that'll allow the player to hop onto the zipline. The problem is, I don't know how to make it so that the OnTriggerStay function from the parent works with the colliders from the children.
I already have the children's colliders in a collider array in the parent's script. Does anyone know how I can make the children's colliders work with the parent's OnTriggerStay function?
Answer by unity_oyq4fQ2B_8I89Q · Jul 12, 2020 at 12:11 PM
Nvm, I got it. If you add a Rigidbody to the parent object, it'll use all the children's colliders for all the OnTriggerStay type of functions. I just added a rigidbody to the parent and froze all the axisses so it could never move, and now it works perfectly.