Collisions are not detected once object with RigidBody becomes a child of another object

Hi all,
have a problem and can’t figure it out.
I have:

  • moving platform

  • character controller player object

  • box object which is destroyed on collision with player

Both box and player become platform children to move along with it. But once box becomes platform child it stops detecting a collistion with player.
This is collision detection code from the box script:

private void OnCollisionEnter(Collision other)
    {
        if (other.collider.TryGetComponent(out PlayerController player))
        {
            Collected.Invoke();
            GameManager.Instance.CollectedBoxesCount++;
            Destroy(gameObject);
        }
        if (other.gameObject.GetComponentInParent<MovingPlatform>() != null)
        {
            transform.parent = other.transform;
        }
    }

Please let me know what am I doing wrong.

OnCollisionEnter doesn’t work with the character controller. Instead you can use OnTriggerEnter and add a second collider to the box and make the second collider the trigger. Also make the trigger collider bigger than the box to make sure it can be touched/triggered.

thank you! will try