How to move around the scene objects with mouse events

Apr 18, 2014 at 11:10 PM
How to move around the scene objects and do the following actions:
  • zoom in\out : using mouse wheel
  • rotate\tilt the whole drawing plan using Left-mouse click and drag
  • pan\move the whole drawing plane using Mouse-wheel click and drag
Thanks
Apr 23, 2014 at 9:46 PM
To zoom in or out, add an event listener to the mouse wheel event. In that event handler you'll want to increase or decrease a class member. Then, in your OpenGLDraw event handler you will scale your object using the value that you updated in the mouse wheel event handler and passing it to the Scale method.

For rotate and tilt, you'll want to add a mouse down and mouse up event listener. In that, detect which mouse button was clicked and set a class member indicating that. Next add a mouse move event listener. In that you'll have to detect which way the mouse moved. Based on that you're going to want to update one or two class members. You'll want one for left/right, and one for up/down. Finally, at the end you'll need to store the coordinates of the cursor for that event. That is how you'll track mouse direction. In the OpenGLDraw event handler you'll use the up/down and left/right values and send them to the Rotate method.

For panning it will be pretty similar to rotate and tilting.
Apr 24, 2014 at 11:23 AM
Thanks gizmodomn for the explanation, but i already know this logic but the problem is i don't know which class member to update in order to achieve Zoom In,Out Rotate, Tilt, Pan, Move for the 3D plan itself. not the selected object.

I already used the SceneControl events:

sceneControl1_MouseClick
sceneControl1_MouseDown
sceneControl1_MouseUp
sceneControl1_MouseMove
sceneControl1_MouseWheel

So i want to control the Scene View itself.

Thanks in advance