I have a DirectX scene. I want zoom in using mouse wheel to the mouse location. I am able to zoom the view to center of screen but I need to zoom to mouse location. Please suggest how it can be done. Thanks
Tell me more
×
Game Development Stack Exchange is a question and answer site for
professional and independent game developers. It's 100% free, no registration required.
|
You need to send a ray from the mouse cursor along the camera view direction through the scene and see where it intersects (take the intersect position closest to the camera position) to know the 3D position. After that you can easily zoom in there by placing the camera closer. This is often called unprojecting and can be done by fiddling a bit with your projection matrix and the screen coordinates of your mouse cursor. |
|||||
|