Raycast Double Click

What’s the best way to handle double clicks when using ray casting?

E.g. if the player single clicks on a tile they can move to, the character should walk there. If they double click the character should run.

Currently just waiting 500ms to see if there’s a second event on the same tile and handling appropriately.

Thanks!

That is wat I would do. And 500 is the Windows default Doe double clicking I believen.

double click is also location based, so on click store the current mouse position and on mouse move check whether its out of a certain area. if its out, you know it’s not a double click and you can trigger your single click action immediately. this adds responsiveness since you don’t have to wait 500ms all the time.

1 Like