Check if mouse/cursor was moved

I want to know if there anything to check the mouse movement. Is there a event or something so i can create a camerareset

you can add an event to mouse x and mouse y under the input manager under:

edit->project settings->input

Add an axis map and apply it to mouse X and another to mouse y.

those events will be called when the mouse moves with a value (so you can add a degree of dead zone)

thanks

here is what it looks like:

It should work fine. In your check it requires both to be zero for not movement. Make syre you have the correct axis selected in the axis map.

I’ve provided an example as well that accounts for a deadzone as well as if input is active or not.

thanks but its not that accurate because if i move my mouse from left to right there is also a 0 value so it would reset any other solution?

okay the problem is solved but it resets instantly

i want a delay of 2 seconds and it should check if in between the 2 seconds of delay it moved

I setup a timer event that does this. It calls the check for movement function every 2 seconds. In the check for movement function it does whatever you want and then resets the mouseMoved variable back to false at the end

Well simpler, it does not check every 2 seconds and requires 2 variables to account for the dead zone where input is ignored since you require a negative and a positive. Other then that, it’s basically the same.

This is one way to ensure the delay is always 2 sec since the last mouse movement

This clears/reset the timer when mouse is moving ,
and sets/starts the timer(delay) when mouse is not moving.

Ockert.

I might be wrong , but the way this timer is setup , will give you an inaccurate and not a constant 2 sec delay since last mouse movement.

Ockert.

Just trying to help.
See the alternative setup above.

the timer will check every 2 seconds not 2 seconds from last input.

As I understood the question , he wanted the camera to reset , if the there was no mouse movement for 2 seconds.If so , the timer should only start counting when mouse movement is = false.

If I misunderstood I apologize for any inconvenience

Ockert.

is right

i hadn’t the time for trying out since now

i wanted it to check for movement and if there is movement i want the timer to quit the event for resetting

Then the screenshot I posted above should work as intended.
The test worked perfect for me.

Feel free to ask if you need more help.

Ockert.

@ How does the “Checkifmousehasemoved” condition look like and how do i create it?

@ okay got it i should use google more before asking ^^ thanks anyways for helping and also thanks to Justin.Dooley :slight_smile:

There are a few ways.That CheckIfMouseHasMoved" condition was just a collapsed node of one of these examples.

1 Like

The 0.5 Values were just tests.Its best to ignore them completely.

Ockert.

best answer!