Raycast bug?

My raycast method doesn’t return true even though it hits something:

if (Physics.Raycast(particles[par].position, Vector3.up, hit, terrainHeight)) {
    Debug.Log("True");
}

It is hitting my terrain mesh, the reason I know this is happening is because I have used, Debug.DrawLine with the same direction, origin and height. Why isn’t the function returning true?

Is your terrain upside down? If not, how can you possible hit it from below? The terrain collider is like a mesh collider. You can only hit the surface from “outside”. That’s actually true for any collider. However colliders like BoxCollider / SphereCollider are closed volumes so you usually aren’t inside the collider, but if you are you wouldn’t hit the collider either. Raycast and Linecast are “directed”. If you reverse your raycast it should work, something like:

if (Physics.Raycast(particles[par].position + Vector3.up*terrainHeight, -Vector3.up, hit, terrainHeight)) {
    Debug.Log("True");
}

edit
Sorry had a typo ^^ fixed the code.