Changing a Value a Specific Rate in Tick
I just moved to ue4 from Unity just about two weeks ago and I'm still trying to find my way around ue4 system. I have quite a bit of experience in programming including c++. I am having this problem that only seems to occurs in ue4. I tried the same code in Unity and it works perfectly.
Vertical and Horizontal Movement are set to the values of TotalVerticalMovement and TotalHorizontalMovement in another method. TotalVerticalMovement and TotalHorizontalMovement contain values that are some positive numbers that might or might not be the same. For some reason when finding the delta time from when Vertical and Horizontal movement are set to when they are 0 takes about 123ms rather than 500ms. Any ideas why this is not running the way I believe that it should?
asked Sep 01 '15 at 06:22 PM in C++ Programming
What does the ShooterWeapon_Instant class actually do? Are you ticking it from the weapons' Tick function? How are you making the other weapons inactive? Are you using SetActorTickEnabled?
answered Sep 02 '15 at 01:55 PM
I don't know how tick works in Unity and waht you expect from it, but i can explain you how Tick works in UE4 so you can setup your code to it.
Tick executes on every frame, it a function made to update actor state for a next frame. as there 0 guaranty that you gonna have stable frame rate, the changes made inside tick need to be time corrected thats what DeltaTime (DeltaSecounds) is made for. It outputs estimated time between frames, if you scale value that changes something (delta) with delta time, that delta becomes "change per sec" value. So for example
X gonna increase it's value 5 per secound and in half secounds it gonna be around 2.5
If something gonna choke in engine and cause lack of tick for longer time, if i rember right over 400ms it will give you maximum delta time of 400ms, in other words simluation virtually gonna pause for moment (which is good thing because player after frezze would jump in time, insted it only jumps 400ms), but all objects gonna recive same delta time so everything gonna be in sync in such situation.
DeltaTime is also importent for time dilation feature of UE4 which let you scale flow of time, it works by manipulating delta times, when engine gonna decrease delta times things gonna go slower.
Follow this question
Once you sign in you will be able to subscribe for any updates here