I could fully resolve the movement in this function,
or
I could just alter some ‘move forward’ value, that then gets resolved in the Tick function.
Has the benefit of not needing a Tick function, but loses deltatime. Less clutter in Tick, potentially not needing to override and don’t need to be bCanEverTick
Has the benefit of a framerate smooth transition, because now I can use deltatime, however now I have to tick and whatnot.
They both have ups/downs depending upon if there are spikes/changes in the FrameRate. I have seen both approaches used in many places. What are your thoughts on why one is preferred?
I know there are a lot of variables of why you choose one over the other. But I am having a hard time resolving what the right questions are to decide.
so in that case, I’d be better off not putting this particular thing in the Tick function, so that things are more encapsulated/modular? Depending upon my design.
Is there then a reason why the Tick function even has a deltatime parameter? If it is globally accessible. or just for convenience and to encourage use of deltatime in Tick?
hi,
I made an RTS camera tutorial you can find here (the corrected/extended version of the Wiki post): RTS Camera C++ - Community Content, Tools and Tutorials - Unreal Engine Forums
imo it is better to only set parameters by the input functions, and do everything inside the tick function to be more transparent for future extensions. moreover, there it is easy to maintain frame-rate independent movement by deltatime.
I am doing something similar and want to allow both keyboard (WASD) and joystick input. I simply hold the current MovementVector in a private FVector (i.e. in MoveRight() I would do MovementVector.X = AxisValue). I then do the movement in Tick() as this allows MovementVector to be set from any of the input methods and resolved in a single place.
Either is suitable since input bindings are ticked anyway by the engine (so long as the object has a controller or is bound to a player I believe), usually they just set a property in the movement component such as an FVector or a float etc, and the MovementComponent ticks and calculates the movement based on that. This is how CharacterMovementComponent works for example.