BGE: Fix for T43980 MouseLook (actuator) triggers MouseMovement (sensor)

on other objects permanently

only trigger mouse event when it is necessary, this way we avoid
conflicts with other mouse sensors.
This commit is contained in:
Jorge Bernal 2015-03-13 00:48:28 +01:00
parent 3db0e1ef6a
commit 73ad76970e
Notes: blender-bot 2023-10-13 01:54:23 +02:00
Referenced by issue #43980, MouseLook (actuator) triggers MouseMovement (sensor) on other objects permanently
1 changed files with 4 additions and 1 deletions

View File

@ -278,7 +278,10 @@ bool KX_MouseActuator::Update()
setposition[1] = center_y;
}
setMousePosition(setposition[0], setposition[1]);
// only trigger mouse event when it is necessary
if (m_oldposition[0] != position[0] || m_oldposition[1] != position[1]) {
setMousePosition(setposition[0], setposition[1]);
}
m_oldposition[0] = position[0];
m_oldposition[1] = position[1];