Camera Panning Using Mouse
Blitz3D Forums/Blitz3D Programming/Camera Panning Using Mouse
| ||
Hi, I was wondering how would I go about in panning my camera using mouse so the object retains its view like 2D panning. I'm doing something like this: If MouseDown(2) Then MoveEntity(camPivot, MouseXSpeed()/2,MouseYSpeed()/2,0) I would just like the screen to pan X and Y |
| ||
Use translateentity rather than moveentity. If it was an rts I'd detect when the mouse is near the edge of the screen. How do you want it to behave? |
| ||
Thanks Matty. Basically I'm trying to do something very similar to Blender's mouse panning (Hold Shift + Middle Mouse Drag). I haven't thought about the limitation yet. Also, how do you pan it smoothly like in Blender? |
| ||
Ok. Detect when relevant buttons are held down (easy bit) and set a flag on indicating you want to pan 'pan mode on/off' If in pan mode translate the camera in the relevant direction by an amount proportional to the distance moved by the mouse raised to the power 'm'. You will need to play around with the values until you get a smooth feel you and your users are happy with. Edit: Move distance = k * abs ( mousemovement ) ^ m |
| ||
Thanks, working ok now. That translateentity really did the trick too! |