mouse pointer boundries and camera movement [SOLVED]

hi there,

i implemented a “typical” 3rd person camera: camera follows an avatar and stays behind the avatar as it moves. movement is navigated via keyboard.

now i wanted to add the ability to orbit around the avatar with the camera (camera keeps looking at the avatar) - but only if a mouse button is pressed; without the mouse button press the camera behaves as described above.

pressing the mouse button and moving to the left or right will orbit the camera around the avatar. on mouse button release the camera just jumps directly to the “default” 3rd person camera position.

so far so good, got the code up and running and it behaves - nearly - as expected.

i have only one problem: while pressing the mouse button and moving to the edge of the screen, the movement stops, because there is no movement registered anymore when the edge of the screen is hit. though the user might still do a physical movement, this information is capped.

i wonder if there is a way in panda to enable these additional information, thus letting the mouse move on a “virtual field” outside the screen boundries (where movement, but also the stopping of the mouse can be recognized - by e.g. calculations like: drag_distance = mouse_current_pos - mouse_last_pos).

if you wonder what i want to achieve: please have a look at the World of Warcrafts camera (thus a lot more intelligent as my current camera code). it combines the “typical 3rd person camera” with the ability to roam around the avatar on mouse button press as described. i hope i was able to explain the effect a little.

as stated essentially i have the code up and running - the calculations are correct, but i’m not sure how to disable that boundry issue.

if you have any ideas or hints how to solve that, i would be happy to hear your thoughts.


ps: i should add that i’m using the prelimnary OS X code. which might create some additional problems. i tried to use to “capture the mouse” before, but this didn’t seem to work (see

(thanks IPKnightly for pointing me to movePointer, unfortunatly i had tried that and i didn’t work for for me so far - i assume this might be a buglet)

Thanks for the clarification IPKnightly. Much appreciated.

Though I have more questions about this.

Using MouseSubregion.set_dimensions will allow me to set the dimensions for the mouse to be recognized. But how does that solve my problem? There will still be an “edge” where the mouse doesn’t move and because:

the mouse does not move but still sends events to the application

That’s what I’m trying to understand here. Panda3D seems not to forward any events anymore as soon as any region edge is reached. Or does it? Are there any means to get to these events? I couldn’t find any references to this in the manual really (and haven’t had time yet to look into Panda3Ds code).

If that’s the case I would need to move the pointer artificially to get the wanted resulted whenever the mouse touches an edge. Using set_dimensions would help me to have an invisible border to allow this action, but I would need movePointer, right?

I am quite sure I might have missed something obvious here, some concept I haven’t yet grabbed. Given the circumstances I’m not quite sure, how you would go on implementing a “mouse capture”.

I will try to code something up and better understand how the system behaves. Any hints until then are much appreciated.

Thanks for your time,

I was able to implement osxGraphicsWindow::move_pointer, that enabled me to implement mouse wrapping easily.

thanks for your input.

ps: see this thread if someone interested in the OS X version.