Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Physics.Raycast does not work if there is a rigidbody attached

Discussion in 'Scripting' started by Topflappen, Jun 30, 2020.

  1. Topflappen

    Topflappen

    Joined:
    Oct 12, 2013
    Posts:
    3
    Hi,

    somehow Physics.Raycast does not detect my collider if there is also a rigidbody attached to the GameObject.
    As soon as i remove the rigidbody, it works. I tried some things. detectCollisions is definitely set to true.

    What might it be?

    Edit: It works sometimes, but it is very unreliable. How do I make it more reliable?
     
    Last edited: Jun 30, 2020
  2. Topflappen

    Topflappen

    Joined:
    Oct 12, 2013
    Posts:
    3
    Ok the problem was my problem. There was a collider in front of my camera that was blocking the raycast