Hello, everyone! Recently I've tried to add an aim assist system to my game and faced some difficulties. I need to mention 2 things:
- I don't use hitscan weapons, so the correction can be done by correcting spawn angle of a bullet or by setting home target component in UE4 projectile movement component.
- I work in UE4 and planning to make this system with C++.
Explanation
Firstly, let me explain what I want to achieve. I want bullets to have a little correction after shooting so that player don't need to aim perfectly. There are some situations where real position of sight is different from actual bullet trajectory, for example:
Central dot is little bit off of the target, but in this case I want bullet to hit enemy.
Part of the enemy is hidden behind the obstacle and central dot is pointing to the obstacle, but still I want bullet to hit.
There are only a little part of enemy visible, and maybe situation a little bit extreme, but I want bullet to hit.
Basically what I want is to have a hit if part of enemy model is inside this shape:
Possible solution
I have only one idea of how it could work. It's scheme looks like this:
So on the upper part of image is how it looks like in screen space view. The blue dot in the center represents a player's sight center and it's a line trace. Then we got a green "circle", basically it's 4 line traces and finally we got red "circle", but again it's just 8 line traces. Side view showing a direction of line traces, they will be traced in cone shape.
How it will work
When one of the red traces hit the target, bullet trajectory will be slightly adjusted to the direction of target, meaning it's not a 100% hit, but rather 50%. If one the green of blue traces hit the target then your bullet trajectory will be adjusted so that's a 100% hit. Blue trace is for situations, when your sight right at enemy, but the green traces don't hit the target.
Conclusion
It's may be not very good solution, for my opinion, because it's not very accurate and may cause some performance issues, since I need to trace 13 lines each frame. But it's the best, which I came up with. So maybe there are some better solutions, which can be done inside UE4.