Hi everyone,
I am building a first person viewer. I am trying to provide the user with control over the viewing.
So far I have implemented a toggle procedure so that when the left button of the mouse is pressed the user is able to rotate the camera around its current position. If the left button of the mouse is pressed again this disables the rotation.
Rotation is achieve using the following call back,
def mouse_cb(self, window, x, y):
if self._toggled['head']:
# spin head around
xoff = (x - self._last_x) * SENSITIVITY
yoff = (self._last_y - y) * SENSITIVITY
self._last_x = x
self._last_y = y
self.viewer.orientation += xoff
self.viewer.inclination += yoff
Unfortunately this does not allow me to rotate 360 degrees around. So far, I can only rotate
as far as the width of my window. If I toggle off (i.e. disable the rotation) and move to the opposite side of the window order to add to my rotation, the camera will reverse to its previous orientation the moment I toggle on (i.e. enable rotation).
If I disable the cursor (using glfw.set_input_mode(window, glfw.CURSOR, glfw.CURSOR_DISABLED)
I am able to rotate quite a bit (as far as the width of my window) but I loose any sight of the cursor something I would like to retain.
I would not mind to be able to rotate ‘progressively’ (by toggling on/off and rotating a bit at a time, if that makes sense) but I have not been able to achieve this.
I was wondering if anyone may have any suggestions on how to achieve this.
Many thanks