08-21-2024, 01:56 PM
The LineSelectorData in v2 has been greatly improved and is now much faster.
Because of those changes, the methods in LineSelectorData class have changed.
As shown in the updated LineSelectionSample, you can get the mouse ray by the following code:
However, I understand your concern and in case when the LineSelectorData class is created with SceneView as a constructor parameter, then the GetClosestPositionOnLine method could internally calculate the mouse ray.
Because of that I have added a new overload to the GetClosestPositionOnLine method that takes a screenPosition (usually the mouse 2D positon). This method will be available with the next version of Ab4d.SharpEngine.
Because of those changes, the methods in LineSelectorData class have changed.
As shown in the updated LineSelectionSample, you can get the mouse ray by the following code:
Code:
var mouseRay = SceneView.GetRayFromCamera(_lastMousePosition.X, _lastMousePosition.Y);
if (!mouseRay.IsValid)
return;
// Then you can call:
var oneClosestPositionOnLine = oneLineSelectorData.GetClosestPositionOnLine(mouseRay.Position, mouseRay.Direction);
However, I understand your concern and in case when the LineSelectorData class is created with SceneView as a constructor parameter, then the GetClosestPositionOnLine method could internally calculate the mouse ray.
Because of that I have added a new overload to the GetClosestPositionOnLine method that takes a screenPosition (usually the mouse 2D positon). This method will be available with the next version of Ab4d.SharpEngine.
Andrej Benedik