Method Raycast
Raycast(Ray, out RaycastHit, float)
Perform physics raycast against this terrain. This is just a convenient function, you can use Physics.Raycast as usual.
public bool Raycast(Ray ray, out RaycastHit hit, float distance)
Parameters
ray
RayThe ray to cast against this terrian.
hit
RaycastHitWill contains hit point information.
distance
floatLength of the ray.
Returns
- bool
True if ray was hit the terrain.
Raycast(Vector3, out RaycastHit)
Perform a top-down raycast against this terrain. This is just a convenient function, you can use Physics.Raycast as usual.
public bool Raycast(Vector3 normalizePoint, out RaycastHit hit)
Parameters
normalizePoint
Vector3Ray position in terrain's normalized [0-1] space. Y component will be omitted.
hit
RaycastHitWill contains information about the hit point.
Returns
- bool
True if ray hits the terrain.
Raycast(Ray, out RaycastHit, float, int)
Perform raycast against all terrain within a group. This is a convenient function, you can use Physics.Raycast as usual.
public static bool Raycast(Ray ray, out RaycastHit hit, float distance, int groupId)
Parameters
ray
RayThe ray to cast.
hit
RaycastHitWill contains information about the hit point.
distance
floatLength of the ray.
groupId
intTerrain group id.
Returns
- bool
True if ray hits any terrain.