Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
LineSelectorData changes in V2
#1
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?
#2
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);
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
  


Forum Jump:


Users browsing this thread:
1 Guest(s)