Add movement input constantly

Hello. I am developing a mobile game. It is necessary that by pressing a button, the character moves along the floor in a certain direction, overcoming obstacles, until it reaches one of the points of interest. AddMovementInput only works with EventTick. Which is not very good. I need to move character until a programmatic cancel command is given.

Any ideas please?

if you dont want to use on tick you can use a function or event with a looped timer and then you can just cancel the timer with ‘clear timer’ node

It’s not like using tick event is not good at all. Event tick is very useful in certain ways. Indeed it cost performance but it won’t if you properly know how to use it.

The “pros” use it with flow control, so it won’t affect the performance that much.

AddMovementInput only works with EventTick.

Disagree ( kind of :wink: ):

Above, axis input fires every frame.

Which is not very good.

Also disagree. It’s excellent this way. You do want to accumulate movement vector every frame for the most responsive controls - that’s the whole point of input! Even the tooltip suggests using it…


[…] the character moves along the floor in a certain direction, overcoming obstacles, until it reaches one of the points of interest.

Sounds like you need a navMesh and have the AI take over for the duration, or until the player interrupts it.

1 Like

Hi there,

If you want an auto-input, you can use an input action with a gate and a flip/flop to toggle on/off:

Or an input axis always forward:

Or this variation for forward/backward with the same input

Hope that makes sense.

1 Like

I’ll add yet another way:

2 Likes

This is good, simpler, it also gives control on auto-manual toggle.
That is the value of Unreal, there are many cool ways to achieve a goal.

2 Likes