Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

Parent Script accessing Child components

$
0
0
Hello, I'm working on a game which uses guided missiles to destroy planes, to do this each plane's parent has a small box collider and a child which has a large sphere collider when the missile enters the large sphere collider it uses transform.LookAt to hone in on the plane. In the plane script (on the parent object with the box collider) when the missile hits the box collider it triggers the plane to explode (in theory) by using this void OnTriggerEnter (Collider other) { if(other.gameObject.tag == "HGP_64") { HeavyMissileDamage(); } } However what's happening is the script above on the parent object is using the sphere collider on the child object to detect the missile therefore resulting in the plane exploding way before the missile hits. How can I stop the parent from accessing the childs collider?

Viewing all articles
Browse latest Browse all 171066

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>