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
rayRayThe ray to cast against this terrian.
hitRaycastHitWill contains hit point information.
distancefloatLength 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
normalizePointVector3Ray position in terrain's normalized [0-1] space. Y component will be omitted.
hitRaycastHitWill 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
rayRayThe ray to cast.
hitRaycastHitWill contains information about the hit point.
distancefloatLength of the ray.
groupIdintTerrain group id.
Returns
- bool
True if ray hits any terrain.