CursorControl::SetPosition spawns mouse events

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Devan
Posts: 4
Joined: Mon Jan 29, 2007 7:29 am
Location: Vancouver, Canada

CursorControl::SetPosition spawns mouse events

Post by Devan »

Hello all.

I couldn't find how to do this in the API or by searching the forum, so I wonder if someone might have some insight. I'm making a custom orbit camera by capturing the mouse move events in my eventReceiver class.

I have the mouse set to the centre of the screen and each time it moves from there I set it back again (the usual low-level way to do mouse look). Unfortunately, when I move the mouse back to the centre using SetPosition, it spawns another mouse move event, and it gets an repeating loop of events.

I know that I could use a quick and dirty fix like not resetting the cursor if it hasn't actually moved, but that still means that there's twice as many events being spawned.
Does anyone know how to disable it so that SetPosition() does not spawn a new event?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

I would think the right solution would be to periodically check the cursor position instead of responding to mouse move events every time one comes in. I know that the code in the FPS camera does this, so it would be a good place for you to look to get some ideas.

Travis
Midnight
Posts: 1772
Joined: Fri Jul 02, 2004 2:37 pm
Location: Wonderland

Post by Midnight »

maya camera scene node works also...have you seen my example in code snippets?

I found that camera system to be very difficult to control correctly with irrlichts querky event reciever.

it is possible I've since abandoned that paticular project and stopped working with that camera.
Devan
Posts: 4
Joined: Mon Jan 29, 2007 7:29 am
Location: Vancouver, Canada

Post by Devan »

vitek wrote:I would think the right solution would be to periodically check the cursor position instead of responding to mouse move events every time one comes in.
That sounds like a good plan. I would still need to use setPosition but wouldn't be affected by any new events.
Thanks for the input guys.
Post Reply