Time and framerate independance
I'm new to the engine and my knowledge is probably inaccurate, so I'm not completely sure what the question is in the first place. I'll give you a brief description of what the problem is:
Trying to create simulations of missiles, and precision in timing is rather important (or my stuff misses by a few hundred meters). I'm trying to create the simulation to be frame-rate independent. Here the available information seems to be a bit conflicting.
It's being said that "Apply force" is frame-rate invariant, and with the following setup, it does indeed perfectly counteract gravity, regardless of frame rate.
However, if I want to apply a force over time, I'd assume I use a timer:
Assuming that 'time' itself is frame invariant, I'd think the later case should produce the same result. However, depending on the timer frequency the amount of force applied actually changes, and setting a -G acceleration on an object with 1kg mass, does not make the object hover.
Similarly, if I use a timer to fire an otherwise 'good' (supposedly tick invariant?) thruster for a brief time, like this: I get a massive invariance in the force being totally applied. (In the above example with a force = 8000, time = 1, the 1 kg object without linear damping reaches a maximum altitude anywhere in between 1500 and 2400 meters.)
This makes me think that either 1. apply force is actually not framerate-invariant, but it's broken in the same way as gravity, so when used together they appear to work correctly. 2. or time itself is not framerate-invariant?
The second case seems to be the logical explanation that I can think of, but that would defeat the point of using timers in the first place. If a unit of time elapsed is proportional to the number of ticks being calculated instead of the actual time elapsed I fail to see how in-game time is supposed to be used (practically timers are simple tick counters that fire with the ticks?).
I might be missing something here, so first of all what could be the actual problem? Given that, what do you think is a suitable workaround? (to make sure the amount of force applied is always constant, and the time period is close to constant)
asked May 26 '15 at 07:33 PM in Blueprint Scripting
Although I don't have a complete solution to the problem, further investigation revealed that the question at hand is more complex than I originally thought, and should probably be investigated in smaller parts. Therefore the original question is obsolete, and I'm marking it as resolved.
answered May 28 '15 at 03:17 PM
Force is time rate invarient, the timer is not. Multiply your (current seconds * delta time) to get a frame rate indepedent time value, and pump that into your timer. Also, bear in mind that even if you force & timer are time rate independent, your actual movement updates may not be. Anywhere you are going to be using a time variable, you need to multiply it by delta time to get your actual framerate independence.
answered May 26 '15 at 07:40 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here