Check for collision between children of objectA and all other objects

I’m having a rough time figuring this one out. I have a player object with many collision objects as children like so:

Player (gameObject with scripts and
meshes)

—Collisions (empty gameObject)

------collision01 (collider object)

------collision02 (collider object)

------collision03 (collider object)

------collision04 (collider object)

------collision05 (collider object)

The script checking for collisions is attached to the Player object. The Player object also has a Rigidbody attached, but no collision component. What I need to do is check if any of the collider objects (the children of “Collisions” gameObject) collide with other objects in the world.

Right now I can’t because if I check for a collider within my script, it throws an error about no colliders being attached to the gameObject, which is correct since “Player” does not have a collider component.

I need something like this (the following code does not work):

public void OnCollisionEnter( Collision collision ) {
		
		if( collider.name != "FrameCollider" )
		{
			return;
		}
            else
            {
                    Debug.Log( collision.transform.name );
            }
		
	}

Thx in advance!

I don’t think it’s possible, because rigidbody swallows children colliders, and you can’t detect them. I faced this problem a while ago, and it’s not possible. You can remove the rigidbody, or make the colliders not parented to it. And then you would attach this script to the children colliders, and then when it collides just send a message to the player.

function OnCollisionEnter( Collision : collision ) {
        if( collider.name == "FrameCollider" ){
            transform.parent.GetComponent(MyScript).collisionName = collision.transform.name;
        }
        else{
            return;
        }}

It’s in JavaScript, because I bit suck, when I wanna make a proper C#. But simply, put this on children, and if children collides with that tagged object send the name to a script called MyScript and var called collisionName, or simply whatever you want.

– David