If collider between two points get this point

Hi!

I need a bit help with Raycasts and Ray.

I got a direction, a length and start position and i want to check whether on this direction was a collider. Then return true.

If its true I’d like to get the point where it was hit.

#------------||----------------------------#
             ^
             |
         This point

otherwise return false:

#------------------------------------------#

nothing between...

So if you dont understand just ask please.

I now tried it with Physics.Linecast … but how do I get this point?

If you just want to know if something is there you can do:

if (Physics.Raycast (origin,direction))
{
	// Do something
}

If you need the position where the raycast hit something:

Ray ray = new Ray(origin, direction);
RaycastHit hit;
if (Physics.Raycast (ray, out hit))
{
    // hit.point contains point the ray hit
}

This is C#. Minor variations if using Javascript.