Forgive me if this isn’t really the proper way to describe this, but I’ll try to clarify.
I have a parent GameObject that I’ll refer to as the “capsule” object. It has two child GameObjects that each have their own Rigidbody and their own Trigger Box Collider. One child object has a script on it (it is the player script that handles movement and other player functions) and the other child object (referring to its sister in the title) is essentially a front bumper that extrudes out in front of the player object. When I call OnTriggerEnter in the player script it gets the Box Collider on the bumper object, which isn’t what I want in this case. Is there a way to make sure OnTriggerEnter isn’t firing off when its sister object is the one getting collision or should I be using a different function for this purpose?
Structure:
Player:
The bumper just has 3 components: Transform, Box Collider (trigger enabled), and Rigidbody.
Collider code on the player script:
void OnTriggerEnter(Collider other) {
//If a player walks into the powerup, grant the player the powerup
if (other.gameObject.tag == "Powerup") {
//etc
}
}