Hello!
Plattform:
- .NET 3.5 with C#
- WPF
- 3DTools
I'm using 3DTools from the Codeplex site (3D Tools) for rotating and panning of 3D Models. This works fine. The Trackball class also contains a method for zooming models with the mouse wheel. However, this method always scales the model with Point(0,0,0) as the center of the zooming. But I'd like to zoom to the coordinates of the mouse pointer (like Google Maps, here you do not zoom to the center of the map but to the mouse pointer coordinates).
I tried different things solving this issue:
- set CenterX/Y/Z of the ScaleTransform3D object of the Trackball class to the mouse pointer coordinates -> it didn't work
- pan the model after zooming -> didn't work too; because the coordinates of the mouse pointer do not change, thus I can not calculate the panning distance, e.g.
- MousePointer Coordinates before zooming -> 334, 210
- call Zoom(-e.Delta) from the Trackball class
- MousePointer Coordinates after zooming -> 334, 210
- if the MousePointer Coordinates would change, e.g. 330, 205, I could pan the model 4 points left and 5 points up (my program has also a 2D mode and there the coordinates change)
- move the camera position -> didn't work; based on the current camera position and the MouseWheelEventArgs.Delta I calculated the new camera position
Has somebody a clue how this problem can be solved?