![]() |
LineSelectorData changes in V2 - Printable Version +- AB4D Forum (https://forum.ab4d.com) +-- Forum: Products Forums (https://forum.ab4d.com/forumdisplay.php?fid=4) +--- Forum: Ab4d.SharpEngine (https://forum.ab4d.com/forumdisplay.php?fid=12) +--- Thread: LineSelectorData changes in V2 (/showthread.php?tid=4465) |
LineSelectorData changes in V2 - henkt - 08-21-2024 In V1 LineSelectorData has a LastClosestPositionOnLine property that returns the position (Vector3) closest to the mouse position In V2 this property has been removed, and a new GetClosestPositionOnLine method has been added. However the method requires rayOrigin and rayDirection parameters which I don't know how to set in this case. Would it not make sense to have a version that uses the pointer position (Vector2) that was passed to the LineSelectorData.GetClosestDistance to determine the closest line? RE: LineSelectorData changes in V2 - abenedik - 08-21-2024 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: Code: var mouseRay = SceneView.GetRayFromCamera(_lastMousePosition.X, _lastMousePosition.Y); 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. |