Download

Ticking vs. user input, and order of execution question -

I was wondering about the order of execution concerning ticking and inputactions. Specifically I have an input action that causes the recalculation of a motor vector. This motorvector is added to the movementvector and the movement is then applied, each tick.

Is it possible that the tick continues doing whatever it’s doing without ever waiting for whatever the inputaction does to finish? I don’t know much about threading but does tick have its own thread possibly?

Thanks!

(this question is also up in the answerhub, in case you want more karma: Tick and input actions order of execution - UE4 AnswerHub )

Consider the tick as being updated every frame. The input usually only fires once (on down and on up). It’s common to use booleans and branches in the tick, these booleans are then turned on/off based in the input.

Right, let me be more specific.
Let’s say inputaction is manipulating the value of a vector, which gets applied to movement at the end of the tick. How do I know when that value will get applied?

Does every input registered during a tick resolve its code before said tick end? Is it possible it could skip a tick and resolve on the next one if the calculation oninput are length?

I guess another question related is how does an inputaction tick itself? Is it parallel to a class’ overridden tick? In serial?

It seems this documentation has the flowchart of the code execution order. From what I can see, all input data is updated before the tick starts in the pawns and Blueprints. Which means that as soon as the flow goes out from the Tick node, you should have the latest input data available when trying to fetch it.

I’m having a hard time seeing the flow you want to do, without a screenshot, but I hope this helps.

Thank you, I had looked at that flowchart but wasn’t experienced enough to know that implied tick execution order.

Essentially in my pawn class is:
Tick override - calcs drag and gravity, adds this to a motor vector setting movement with sweep, this final movement vector is stored be used next tick for momentum

OnInput set motor vector - this looks at a simple movement state bool and creates the motor vector appropriately, which is then applied in the tick.