Let say that I have a GameObject which is a melee weapon.
The part that is use for hit detection is a Child Transform.
There could be several per Weapon
The Main Script is attach only to the Base Transform.
Main Script has reference to all of the colliders in Children Transform.
Even If more than one Collider hit an enemy,
DealDamage() function should be call only once.
Instead of calling OnCollision from the Child Transform,
Is it possible to detect if any of the collider in children hit something instead?
Thank you YoungDeveloper, you had solve half of my issue. The other one was that the Collider and Script weren't attach to the same Transform.
– LevantezThank you for your help, currently we have the 2nd option implemented, when what we wanted to achieve was the 1st option. The problem was that we couldn't figure out the function that check whether any of the child collided with something or not. We found OnCollisionEnter and OnTriggerEnter, but we couldn't get them called from the parent object
– LevantezAgain, Thank you for your help, I will try it out.
– LevantezThank you, I got it working now! As a sidenote, it will not work if the child also contain RigidBody
– Levantez