|
LineSelectorData Methods |
The LineSelectorData type exposes the following members.
Methods | Name | Description |
---|
| CalculateViewPositions |
CalculateViewPositions method converts the 3D line positions into 2D positions on the screen that can be used for calculating distance to specified 2D position.
This method must be called before GetClosestDistance(Vector2, Single) or GetClosestPositionOnLine(Vector3, Vector3) methods can be called.
The SceneView property must be set before calling this method.
When calling CalculateViewPositions on multiple instances of LineSelectorData, it is recommended to use CalculateViewPositions that takes worldToViewMatrix and dpi scale.
This is faster because SceneView.GetWorldToViewportMatrix is called only once.
|
| CalculateViewPositions(Matrix4x4, Single, Single) |
CalculateViewPositions method converts the 3D line positions into 2D positions on the screen that can be used for calculating distance to specified 2D position.
This method must be called before GetClosestDistance(Vector2, Single) or GetClosestPositionOnLine(Vector3, Vector3) methods can be called.
|
| GetClosestDistance |
GetClosestDistance method calculates the closest distance of the line to the specified screenPosition.
In case CheckBoundingBox is true (by default) the method returns float.MaxValue when the screenPosition is outside the bounding box.
See remarks in the CheckBoundingBox for more info.
Before calling this method the CalculateViewPositions method must be called.
This method also sets the LastDistance property.
To get the line segment index that is closest to the screenPosition read the LastLinePositionIndex property.
|
| GetClosestPositionOnLine(Vector3, Vector3) |
Gets the Vector3 that represents the closest position of the line segment with index LastLinePositionIndex
to the specified ray. The ray is usually calculated by SceneView.GetRayFromCamera method.
|
| GetClosestPositionOnLine(Int32, Vector3, Vector3) |
Gets the Vector3 that represents the closest position of the line segment with index LastLinePositionIndex
to the specified ray. The ray is usually calculated by SceneView.GetRayFromCamera method.
|
| UpdateLinePositions |
UpdateLinePositions method updates the 3D line positions that are used to calculate the distances.
This method needs to be called when the 3D line positions are changed.
|
TopSee Also