# Aiming prediction

**URL:** <https://forums.unrealengine.com/t/aiming-prediction/665566>\
**Category:** Blueprint\
**Tags:** unreal-engine, UE5-0, Blueprint, question\
**Created:** [October 9, 2022, 10:35am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566 "2022-10-09T10:35:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [October 9, 2022, 10:35am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/1 "2022-10-09T10:35:12Z")

</div>

Hello,

I’m trying to figure out an aiming prediction for a projectile affected by gravity. I need to calculate the gun rotation for the future location of the target accordingly to the projectile trajectory.  
Earlier I made this implementation for the case if there is no gravity.

 ![ue_projPrediction](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/f/8/df8cc8b2d693322ba9da38330f2274982b812084.jpeg)

I can’t figure out how to take into account gravity. Also, I found that the projectile gravity scale in the projectile movement doesn’t affect the Projectile Velocity Vector (Get Velocity node). As I understood this gravity scale is fake physics.  
And I don’t understand how exactly this affects the projectile velocity vector  
 ![ue_projPrediction2](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/7/3/07332d139a08ae8f7498a674b9891f642c177a70.jpeg)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 9, 2022, 10:41am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/2 "2022-10-09T10:41:07Z")

</div>

Did you know about this?

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/5/2/f52601769d89dbe5b72a019f24a57236ff9abd60.png)

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [October 9, 2022, 10:49am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/3 "2022-10-09T10:49:08Z")

</div>

Yes, I recently found this node but I haven’t figured out how to use this yet. This node just shows a trajectory

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 9, 2022, 10:57am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/4 "2022-10-09T10:57:33Z")

</div>

I’m not entirely sure how it works, but isn’t the last point where it’s going to hit?

---

<div class="post-metadata">

**Author:** ![Yaklakootmaa2](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/yaklakootmaa2/32/1194607_2.png) [@Yaklakootmaa2](https://forums.unrealengine.com/u/Yaklakootmaa2)\
**Post date:** [October 9, 2022, 11:08am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/5 "2022-10-09T11:08:02Z")

</div>

Yes but I need the opposite result, I need to calculate the gun rotation for the future location of the target accordingly to the projectile trajectory.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [October 9, 2022, 11:47am UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/6 "2022-10-09T11:47:18Z")

</div>

That, I don’t know… 🤔

---

<div class="post-metadata">

**Author:** ![Kain\_Shin](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kain\_Shin](https://forums.unrealengine.com/u/Kain_Shin)\
**Post date:** [December 27, 2025, 5:30pm UTC](https://forums.unrealengine.com/t/aiming-prediction/665566/7 "2025-12-27T17:30:39Z")

</div>

Epic provides

```auto
SuggestProjectileVelocity_MovingTarget

```

… that you can use, but it makes you pass in TimeToTarget instead of calculating that for you based on projectile speed and target’s velocity.

I wrote this derivation a long time ago that leads to a version of this that will calculate TimeToTarget internally:

> **[Predictive Aim Mathematics for AI Targeting](https://www.gamedeveloper.com/programming/predictive-aim-mathematics-for-ai-targeting)**
>
> A while back, I decided to look up algorithms for predictive firing on the internet, but I couldn't find any that incorporated acceleration in three dimensions, so I decided to give that the old college try.

A shareable version of my current Unreal function for it can be found here:

[https://ringofblades.net/Blades/Code/PredictiveAim.cpp](https://ringofblades.net/Blades/Code/PredictiveAim.cpp)
