ZoomAtPoint with perspective view issue

Hi community.

I want to implement a zoom on the cursor position but I have an issue or a misunderstanding of the "ZoomAtPoint" feature.

First of all, I don't have the issue with orthographic projection, when zooming in this mode, my cursor always stays on top of the exact same point in the 3D view.

With perspective mode, I see that the next point don't stay under the cursor. It move a little and the more other shapes go out of the view boundaries, the more this effect is visible.

My 3D view comes with default with a very large trihedron (100m on each axis) and when if this trihedron is displayed, the zoom act like a zoom in / out using the view center point.
You can see my model in attached files.

I think I use view.StartZoomAtPoint and view.ZoomAtPoint functions correctly (OK with orthographic view) but I don't understand why I can't make it work with perspective mode.

Thank you for your help !

gkv311 n's picture

You are referring to the legacy functionality in V3d_View, which doesn't have access to objects picking functionality.

AIS_ViewController implements zooming at point by picking 3d point lying on an object under mouse cursor (from AIS_InteractiveContext) and adjusting zoomed camera to keep this 3d point at the same position in pixels.

Guillaume CHAFFAROD's picture

Thank you, I now use the view controller and it does exactly what I need.

Guillaume CHAFFAROD's picture

Finally, I still have some issues with the perspective camera view.

Now I can zomm at the mouse point when the cursor is over any object on the 3D view, but when the cursor is over the background (not over any 3D object), it still zoom on the view center.

Moreover, I have to switch the selection mode of all my AIS objects to full object selection.
For example, when I'm in "wire" selection mode for an AIS shape that has edges in its sensitive entities, the camera zoom at the mouse point ONLY if i'm over an edge of the shape.

I still don't have any problem with the orthographic view mode.

Is there a way to configure the view controller to zoom regardless of selection modes ?

If anyone has an idea I would really appreciate.