I recently started trying out GAS for some basic excercises, but when using the node Apply Root Motion Constant force, I realized the in game behaviour was off. Checking the world transformation, I realised that the framerate affects the overall distance.
Here are some results and the settings of the node (World direction is actor forward vector)
After debugging, distance travelled depending on FPS is the following:
60 fps: 1033.33
30 fps: 1000.00
15 fps: 1066.66
This issue is consistent with the framerate. I’m not sure how to fix this myself, but it feels like a long term major issue that needs to be addressed.
This looks to me like a “Last Frame Error”. It happens when you have significant displacement during a frame. (with very high speeds)
As seen in your screenshot 0.5 seconds with 15 fps is 7.5 frames which means that the last frame should only displace you half as the others 7. However I doubt that this kind of correction is implemented as it might be seen as unimportant.
For proof you can do the math:
1000 units for 7.5 frames is 133.3(3) units per frame. However the movement is conducted for the whole 8 frames, hence 8 * 133.3(3) = 1066.6(6)
Now I’m guessing you are not hitting 60fps exactly so that’s why the 60fps is also a bit mangled.
If you want to be that perfect you’ll have to take into account the last frame error.
Thanks for the response… I’m not sure how to change the behaviour of the node to account the last frame error though. Does it involve tinkering with the node itself or can I work it out with the values added into it?
Don’t bother. Really. I strongly recommend to let it go if it is not critical to your gameplay.
Set the Strength Over Time curve to reduce the force at the end of the transition. You will have to eyeball the distance but the consistency should be much higher as the error at the end will be much smaller.
Try using another node. “Apply Root Motion Move to Force” seems like a good candidate but I’ve never tried it.
Manually teleport the character back where they should be after the they overshoot the target. It might be noticeable but it will be EXACT. (after all we can make some sacrifices if correctness is paramount)
Keep track of the the traveled distance and at some very small remaining distance cancel the Async Task returned from the node. Then move the rest of the distance manually- hopefully it is very little. This has higher chance to be more noticeable because the “small distance” will need to correspond to the speed and the frame rate BUT you guarantee you wont overshoot.
Save the error and nudge the character ever so slightly when they start to move again in order to distribute the error and make the correction less noticeable. Fingers crossed, they move very shortly after.
Hope at least one of those is useful. (I’m betting 1)
Thanks for the insight. I could use the Apply Root Motion Move to Force node, but I oddly enough can’t find anything regarding it, and can’t figure how to add it into a BP graph…
Still I will probably keep this as is for now since the distance difference is just 2-3% and under very unlikely scenarios, so anything that doesn’t need surgical precision should be fine.
I just didn’t want to roll with an error I didn’t at the very least understand.
Thank you for the help and insight!