How to make the raycast ignore its parent?

The raycast from my gun start at the main câmera. But if the angle is too low (if i look to the floor), the raycast hits the player. If i keep shooting at the floor, i die (whatheheck). I was previously raycasting from an empty GameObject in front of the camera, and was working just fine.

My script just in case:

if (Physics.Raycast(Camera.main.transform.position, Camera.main.transform.forward, out ray, range)) {

    life = ray.transform.GetComponent<life>();
    if (life != null) {
        life.TakeDamage(damage);
    }

rigidbuddy = raio.transform.GetComponent<Rigidbody>();
if (rigidbuddy != null) {
    rigidbuddy.AddForce(-transform.forward * 40 * danodaarma);
}

}

Usual everyday stuff. I don’t know why such a bug happens.

just turn off queries start in colliders and it ignore the collider when cast start inside of it

You can pass a layermask in the Pysics.Raycast method. Create a Player layer and set the layermask to ignore the player.