The title says it all. I’m writing a script to handle aircraft flight. I have roll, yaw and pitch controlled by mouse movement. Everything “works” except that the bge.render.setMousePosition causes the the object to continue rotating after the mouse has stopped moving. My method is to set the cursor to the middle of the screen after each frame (during flight) to just track how much the mouse is being moved from that center point. Any idears?
You might be setting the mouse to an off-center position or comparing its offset with the wrong position. Posting your logic setup and script would help.
I use a similar way to track movement and I noticed that sometimes the mouse doesn’t stay precisely at 0.5,0.5 but, a frame after locating it at the center, the position becomes like 0.5,0.4993. I didn’t check out the reason for lazyness and decided to just apply a threshold so that if the delta is less than some small, configurable value, the mouse motion is not considered on one or both axis.
It’s hacky because the resolution of the mouse translation depends also on the hardware so I might be cutting away a legitimate input coming from a high end system but I haven’t had a better idea and it worked so far.