Issue with Tick vs SetTimerForNextTick
I've recently been using a workflow I'd created where I can avoid calling functions in main tick, by just contextually setting Timer for next tick.
Tick (empty) Start Mechanic function (from input) - start mechanic calls next function towards end. DoMechanicSimulatedTick (runs stuff whilst mechanic is active such as SetActorLocation) EndMechnic
The simulated tick function is literally just a function that runs, and then if it's still eligible to run, it set's a TimerForNextTick of itself on this actor.
However, I've noticed that if I use this workflow, SetActorLocation becomes choppy.
If I just comment out the line for setting a timer for next tick, and remove the call from the start mechanic function, and INSTEAD check the mechanic state and then run the Simulated Tick Function from Tick, it is smooth.
Anyone know why this is happening? "What Do?"
Thanks in advance
asked Apr 25 '19 at 04:51 PM in C++ Programming
Turns out that this workflow is flawed due to the fact that all timers are invoked between PostPhysics tick group and PostUpdateWork (at least according to the documentation here: https://docs.unrealengine.com/en-us/Programming/UnrealArchitecture/Actors/Ticking)
This means that the set location of the actor doesn't work smoothly because the physics has already been calculated and it doesn't seem to like/agree with that update happening so late.
I've just moved it all into a switch statement instead within Tick - works perfectly as expected.
answered Apr 25 '19 at 05:26 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here