/// <summary>
/// Raycasts from center.
/// </summary>
/// <returns>RaycastHit if something is hit, or null if nothing is hit.</returns>
/// https://gist.github.com/Ashwinning/d87e014cce668411adb9
RaycastHit RaycastFromCenter
{
get
{
// Determine if we hit anything
Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5F, 0.5F, 0));
RaycastHit hit;
if (Physics.Raycast (ray, out hit))
{
return hit;
}
else
{
return hit;
}
}
}
Last active
February 9, 2016 23:58
-
-
Save Ashwinning/d87e014cce668411adb9 to your computer and use it in GitHub Desktop.
Raycast from center - Raycasts to infinity from the center of the screen - Returns RaycastHit object if something is hit, or null if nothing is hit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment