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!