Problem with an extension of the mouse input of tutorial 4

ncazanav

10-02-2007 00:19:40

Hi all,

I would like to control the camera in the scene as it is done in the Ellipsoid Collision Detection exmaple application of Paul Nette (downloadable at http://www.paulnettle.com/ in the code section.

So I slightly modified the code of tutorial 04 in order to rotate directly the camera as the user move the mouse, without to press any button. I modified the original code

void MouseMoveHandler(object sender, MouseEventArgs e)
{
if (mRotating)
{
float x = mLastPosition.X - Cursor.Position.X;
float y = mLastPosition.Y - Cursor.Position.Y;

Camera.Yaw(new Degree(x * ROTATE));
Camera.Pitch(new Degree(y * ROTATE));

mLastPosition = Cursor.Position;
}
}


to simply this :

void MouseMoveHandler(object sender, MouseEventArgs e)
{
float x = mLastPosition.X - Cursor.Position.X;
float y = mLastPosition.Y - Cursor.Position.Y;

Camera.Yaw(new Degree(x * ROTATE));
Camera.Pitch(new Degree(y * ROTATE));

mLastPosition = Cursor.Position;
}


Everything works fine, but the problem is the following : as soon as the mouse leaves the form, there is no more rotation of the camera because the mouse events are only fired when the mouse move over the form!!

How can I achieve something similarly to Paul Nette's application with Mogre?

CK_MACK

11-02-2007 01:00:55

Hmmm... I use DirectInput to control my mouse and it does not seem to lose the ability to move the camera when I leave the window.

MACK

ncazanav

12-02-2007 17:04:37

Thanks, i'll have a look at that

linkerro

13-02-2007 12:29:19

You can also try using global mouse hooks. It's a tad trickier but it will also work.

Recommended version is to look in the ExampleAplication and see how it's done there.