- Home /
Check collision of childs Trigger in Parents script [JS]
I need to make whole in one AI script so i need to check if my AngryCubies Weapons trigger is triggered by player. I know how to check if it's player, but how can I use OnTriggerEnter() for child when script is component of parent?
Answer by facePuncher7 · Mar 28, 2016 at 02:45 PM
The easiest way I've found to do this is to attach a script to all children that sends collision data to parent. Something like this:
function OnCollisionEnter(collision : Collider){
transform.parent.GetComponent(ParentScript).ChildCollision(collision);
}
Could you explain a little more what would parent receive from this? I could understand the idea but im not sure how to use it in parents script.
Your answer
Follow this Question
Related Questions
OnTrigger event when colliders are already touching eachother 1 Answer
Player Falls Through Floor on Trigger 1 Answer
Trigger not detecting tag 1 Answer
Multiple OnTriggerEnter on One Collider 1 Answer
Why won't the collision work? 3 Answers