Download

Jump to a clicked location (leap)

I’m using the TopDown Template. By default, LMB click moves the character to a location user clicks on.

I’m trying to use the same logic but with jump (RMB).

So far I’ve made my character jump upon RMB click and it works fine when the character is moving, because it has the momentum and jump moves the character forward to a clicked location.

However, I would like my character to jump / leap to a clicked location, even if it is standing still (instead of just jumping in place).

The best example of what I’m trying to accomplish would be barbarian leap from Diablo 2 / 3.

Hi man, you need to get the coordinates of the mouse in 3d,
you can use this https://www.youtube.com/watch?v=b1_efR9hrT4
once you have where you clicked,
you can turn the actor in that direction find look at rotation https://www.youtube.com/watch?v=zsPG_4vrbYI

Then you have to manage the distance covered by the jump and the speed

TopDown Template already has the GetWorldLocation, it is used for LMB, I’ve added it to RMB as well. Character rotation is done automatically when the character starts to walk towards the clicked location.

Now… when I think about my character’s movement, I kind of like the idea that it has to run before starting a leap, at least for a few meters. The game is fast-paced, it has a timer and you need to avoid things from hitting you. So in fact, having a character jump while being still would in many scenarios be too easy. Having to find a space to move first among the enemies and traps gives the gameplay a nice touch. :slight_smile:

I think I’ll make the active movement a requirement in order for RMB (jump) to work.

**I’ll also need this: **How can I add a specific radius around my player in which RMB click will be ignored? For example, if the character WALKS 1 meter way from its current location, that is perfectly fine. But it shouldn’t jump if clicked so close.

Thanks!