Unity answers on how to produce raycasts such as: Raycasting from center of screen instead of mouse location - Questions & Answers - Unity Discussions
suggest you use something like:
Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0f));
RaycastHit hit = new RaycastHit();
if (Physics.Raycast(ray, hit, 600))
{
}
Whereas the API documentation says…
Vector3 fwd = transform.TransformDirection(Vector3.forward);
if (Physics.Raycast(transform.position, fwd, 10))
print("There is something in front of the object!");
And the aforementioned method does not work, or rather the method overload does not exist so I’m assuming it changed.
Did it in-fact change? If so, why?