Panning and Zooming
Posted 09 August 2012 - 04:28 AM
Does anyone have some suggestions or pseudo-code for this simple (but yet complicated for me) thing? I have a raycast function that gives me the 3d point under the mouse, but I have no clue how to apply this to what I'm trying to do!
Posted 09 August 2012 - 01:37 PM
Posted 09 August 2012 - 02:07 PM
camOrg += camDir*Delta; reads as if you move the camera foreward. This is not the same as zooming. I would say that for zooming you would typically adjust the projection matrix rather than moving the camera. This means that while zooming your camera stays in one place. Therefore if your mouse position is not exactly along the center you can not zoom and keep the mouse in relative distance to the center of your screen. When you zoom, everything will move towards the outer egdes of your screen (exept the exact center). Think of a sniper in a FPS. You don't have to move the player while you zoom in with the scope. You could reorient the camera to the point that you click and then zoom in.
As for the panning there is also a problem with your idea. Panning is essentialy a rotation around the up vector. You could make a 360 Degree rotation. It is impossible to keep the mouse click in possition while rotating like that. Maybe you need to be more specific about what you try to achieve.
Posted 09 August 2012 - 02:46 PM
Panning, I want to move left/right/up/down the 2D screen, not rotate. But I want to keep the 3D clicked point (or the object) under the mouse while I drag the mouse, so you can predict how much to drag the mouse to have the scene moved to where you want it.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users