Assembly: Fix Object disappears when dragging with slider #12449

This commit is contained in:
PaddleStroke
2024-02-26 15:56:01 +01:00
committed by Yorik van Havre
parent a6752bf0cc
commit afa4a696ab

View File

@@ -2732,7 +2732,17 @@ SbVec3f View3DInventorViewer::getPointOnLine(const SbVec2s& pnt, const SbVec3f&
SbVec3f pt, ptOnFocalPlaneAndOnLine, ptOnFocalPlane;
SbPlane focalPlane = vol.getPlane(focalDist);
vol.projectPointToLine(pnt2d, line);
focalPlane.intersect(line, ptOnFocalPlane);
if (!focalPlane.intersect(line, ptOnFocalPlane)) {
return {}; // No intersection found
}
// Check if line is orthogonal to the focal plane
SbVec3f focalPlaneNormal = focalPlane.getNormal();
float dotProduct = fabs(axis.dot(focalPlaneNormal));
if (dotProduct > 1.0 - 1e-6) {
return {};
}
SbLine projectedLine = projectLineOntoPlane(axisCenter, axisCenter + axis, focalPlane);
ptOnFocalPlaneAndOnLine = projectedLine.getClosestPoint(ptOnFocalPlane);