0
\$\begingroup\$

I am trying to do the top down project from scratch.

I can already get the actor to move toward the mouse click:

enter image description here

Only I need to keep clicking several times to change its path and keep walking indefinitely.

I would like to know how to keep it moving while I hold the mouse button.

In the previous version (4.21) this code below fit perfectly, so I managed to do that (the condition was a variable that only became false when I released the mouse button):

enter image description here

But now I can't make this connection (4.22).

I searched for some functions and even searched the new documentation for this loop (While Loop), but nothing worked.

Link (While Loop BP UE4):

https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/FlowControl/index.html#whileloop


Player Blueprint:

enter image description here


As I could do this before, you can see in the answer to this question:

How to make my character walk by clicking and holding the mouse button?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Rebuild your Nav Grid. The SimpleMoveTo function fails if there is not a valid path to the target. You should decouple the mouse down and up via a boolean variable so the entry point is mouse down going into the delay then test the boolean for is still pressed, try move and delay... loop back to test bool. On success or relase of button, set boll to false. \$\endgroup\$ Commented Sep 14, 2024 at 5:32

1 Answer 1

0
\$\begingroup\$

Why dont you do it in Tick ?

You still can set the boolean variable on input action - and then use EventTick with conjunction of delay and send the player to the mouse location.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Repeatedly calling a latent function from almost anywhere is a bad idea. calling delay from a tick is wasteful. Use a delay loop from Begin Play. And the mouse location is in screen space and must be projected onto the 3D world into a location accessible on the nav grid. \$\endgroup\$ Commented Sep 14, 2024 at 5:23

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.