Interface ILineRenderable
Get line points and hit point info for rendering.
Namespace: UnityEngine.XR.Interaction.Toolkit
Assembly: Unity.XR.Interaction.Toolkit.dll
Syntax
public interface ILineRenderable
Methods
GetLinePoints(ref Vector3[], out int)
Gets the polygonal chain represented by a list of endpoints which form line segments to approximate the curve. Positions are in world space coordinates.
Declaration
bool GetLinePoints(ref Vector3[] linePoints, out int numPoints)
Parameters
Type | Name | Description |
---|---|---|
Vector3[] | linePoints | When this method returns, contains the sample points if successful. |
int | numPoints | When this method returns, contains the number of sample points if successful. |
Returns
Type | Description |
---|---|
bool | Returns true if the sample points form a valid line, such as by having at least two points. Otherwise, returns false. |
Remarks
Getting line points with Vector3 array is much less performant than using a native array. Use GetLinePoints(ref NativeArray<Vector3>, out int, Ray?) instead if available.
See Also
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
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. |