Method TryGetHitInfo
TryGetHitInfo(out Vector3, out Vector3, out int, out bool)
Gets the current ray cast hit information, if a hit occurs. It returns the world position and the normal vector of the hit point, and its position in linePoints.
Declaration
public bool TryGetHitInfo(out Vector3 position, out Vector3 normal, out int positionInLine, out bool isValidTarget)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | position | When this method returns, contains the world position of the ray impact point if a hit occurred. |
| Vector3 | normal | When this method returns, contains the world normal of the surface the ray hit if a hit occurred. |
| int | positionInLine | When this method returns, contains the index of the sample endpoint within the list of points returned by GetLinePoints(ref Vector3[], out int)
where a hit occurred. Otherwise, a value of |
| bool | isValidTarget | When this method returns, contains whether both a hit occurred and it is a valid target for interaction. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if a hit occurs, implying the ray cast hit information is valid. Otherwise, returns false. |