Stride Forums Archive

Raycast Double Click

3 posts, 2817 views, 2016-04-20 to 2019-05-08

AlistairClark (Alistair Clark) 2016-04-20 #1

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!

Aggror (Jorn 'Aggror' Theunissen) 2019-05-08 #2

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

tonfilm 2019-05-08 #3

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.