How to know which child collider triggered in parent?

发布时间:2026-01-18 23:35

商务报告中,'in conclusion'表示总结,'to summarize'也有类似含义 #生活技巧# #职场沟通技巧# #商务英语#

You can give the parent class a public method that takes two arguments, a Collider and some form of identification for which child was hit (e.g. a Transform or Vector3 or int id, depending on what layout the children are in). Then, in each child object, give them a script like

using UnityEngine; public class ChildCollider : MonoBehaviour { void OnTriggerEnter(Collider other) { transform.parent.gameObject.GetComponent<ParentScript>.OnChildTriggerEntered(other, transform.position); } }

and in the ParentScript script

public void OnChildTriggerEntered(Collider other, Vector3 childPosition) { //Do stuff }

网址:How to know which child collider triggered in parent? https://klqsh.com/news/view/321211

相关内容

How to know which child collider triggered in parent?
How to kill suspended processes in Windows 10
Why You Should Never Spank Your Child
How To Know Your PM Kisan Registration Number Online
How to use file explorer in Windows 11
How to create a new Microsoft account
Look! How to Get Help in Windows 10 (6 Ways Included)
September is National Afib Awareness Month. Join the 2025 Get in Rhythm. Stay in Rhythm. Afib Awareness Campaign
亲子关系问卷(Parent–child relationships scale,PCRS)
How to Get PM Kisan Registration Number: Full Process

随便看看