In order to get my character catch a projectile I need to know if it is going to make it in time to the destination location.
The pawn is going to reach that by accelerating for a certain space and then moving at constant speed for the remaining part.
I calculate the time for both them, sum them up, and compare the result to the time the projectile takes to reach destination.
s1 = v^2/2a → Space the character needs to reach Max Speed.
s2 = Total Space - S1 → Space the character will cover at max speed.
t1 = V/a → Time it will take the character to accelerate to max speed.
t2 = s/v → (S1 - S2) / 600 - time it will take it to cover S1 - S2, the remaining space at average speed.
Then T1 + T2 should give the total time the character takes to get to destination.
The problem is that i get results higher than in reality.
What am I missing? how can I calculate the time to destination reliably?
Since you need a reliable result (catch object at location), I would definitely fake the movement like a cutscene. Your calculations might not be as straight forward as you think. For example, your pawn movement might be dependent on calculations being done on the navigation system. it’s acceleration will change when the pawn has to rotate. It will be affected by plenty of factors on the movement component and external factors. What if you halfway development decide that your pawn should move a little faster on the movementcomponent and unexpectedly the scene where he is supposed to catch something breaks?
That said, instead of calculating how much time it takes to go somewhere and walk there, you should teleport him hover a predefined path taking X time. Usually people use splines for this, imagine a cart on a rollercoaster but instead of setting the speed for that cart you say “this path takes 1 minute” and move over the spline using time as a key to retrieve position as a value. You could also take a look at how to set up cutscenes.
Well, the characters strafe to destination on a navmesh so external factors such as rotations and speed variations should be mitigated, but I see where you are coming from.
I’m not sure if I’m getting it right: you are suggesting to, instead of predicting the time to destination making the character move in a pre-established time?