Ends Today: Save up to 95% on the Time Travel Mega Bundle!

Demo Video: https://youtu.be/Ub3gSSMv9gg


Prediction Projectile V2.0 Documentation

 

This product contains 5 blueprint functions that allow you to run RLS estimations on targets and shoot projectiles at them with prediction. RLS estimation ensures higher probability to hit a randomly moving target. No matter the target is moving linearly or turning, no matter it is accelerating or moving at a constant speed, you will always have a higher chance for a direct hit.

 

About RLS Estimation

RLS is short for Recursive Least Square. This algorithm can process streaming data in runtime and model the input-output relationship of the data with multi-nomial equations. For more info, pls visit this wikipedia link. Because RLS is relatively low on computational cost and can yield results in runtime, it is often used in auto piloting. It is recommended to use RLS only when the target’s path is unknown. If your target is moving along a spline, or is mocap data, then it is not necessary to use RLS, since you can just get the ground truth. Both RLS and customized prediction equation are supported by this product. You don’t have to understand how RLS works. You can simply create variables for each function input and let the function do the rest.

 


Parameters Explanation


RLS Solver Functions


The RLS solver is splitted into two steps for the following reason:

If you need to track multiple targets at the same time with RLS, you only have to run Step 1 node one time each iteration. This result will apply to all targets you want to track. You then need to run Step 2 node on every targets to solve their own path equations.

 

Note that the RLS solver can predict all sorts of things, not just Time-Location equations. Wn array's default value have 3 members because a coordinate has 3 dimensions. It can be as many members as you need.


1. PArray: Variable to cache the P Matrix of RLS Math Expression.

2. Kn: Variable to cache the k vector of RLS Math Expression.

3. Xn: Variable to cache the X matrix of RLS Math Expression.

4. Timer: The function input. It’s the delta time since the RLS solver first started.

5. Forgetting Factor: The strength that RLS will prefer newer data. 1 means no forgetting at all.

6. Yn Array: Is the array that holds the x,y and z coordinate of each target location sample.

7. Wn Array: Is the array of 3 members,each of which is one w vector of RLS Math Expression. The 3 members corresponds to the 3 dimensions of a coordinate.



Relay RLS Solvers Macro


Pn variable tend to be too large for the engine to calculate when running a RLS solver for more than 150 iterations. To solve this issue, you can use this Macro to relay between two RLS solvers. The Macro overlaps the two solvers' runtime. It switches to another solver's result after pre-running the solver for the number of iterations you give in the Pre Run Iterations variable to ensure a smooth transition between solvers. If you just need to run RLS a few seconds while your character is aiming, then you won't be needing this.

 

Note:I used the vector2d for the timer variables only to make use of the set vector 2d node to be able to set the value inside a function, so you don't have to fix variable reference problems.

 


Projectile Solvers


There are two functions related to projectile solvers. One is used inside the other. The main one is the Solve Projectile with Prediction function. Since the RLS has given us the Time-Location relationship of our target. We then use this relationship to calculate the projectile parameter. The result of this function can then be used to spawn a projectile that will hit the target with prediction. The Can Reach Target output pin will show whether or not the target is within shooting range. You can decide not to shoot when the target is not within reach.

 

1. To Location: The current location of the moving target.

2. From Location: The current location of the shooting site.

3. SolveMode:

Solve initial velocity with given pitch angle, suitable in archery to show a cooller trajectory and still hit a moving target.

Solve pitch angle with given initial velocity, suitable for high speed projectiles like bullets and cannon balls.

4. Fixed Pitch Angle: Fill in the pitch angle used to fire the projectile in degrees.

5. Fixed Projectile Speed: Fill in the projectile speed used to fire the projectile.

6. Gravity: Define the gravity that will effect projectile motion.

7. Precision: Gets more precise with bigger numbers, 2 is good enough.

8. RandomMin and Random Max: The neutral is 1, you can set Min to 0.9 and Max to 1.1. Not network replicate.



The other is the Customizable Time-Location Function.

This is the RLS version. This function is placed inside the previous one. But if your target's future location can be better predicted with other methods rather than RLS, say the target is moving along a known spline, or is mocap data. In those cases you need to put in your own Time-Location equation into this function, And just use the projectile solver alone(since you are not using RLS estimation).

 


1. Current time:The current delta time since this solver’s time of activation.

2. Time Of Prediction: The future time based on the current time.

3. Even Expected Acceleration and Corrective Multiplier: Due to characteristics of multinomial equation, the estimation tend to think the target will keep accelerating after each turn. But in most cases the target's speed is relatively constant. To fix this, two parameters are introduced. Bigger Even Expected Acceleration means the target's will keep a more constant speed after each turn(default 5), the Corrective Multiplier adjust the overall speed after each turn.

Technical Details

Features:

  •  Shoot a randomly moving target with given pitch angle.
  •  Shoot a randomly moving target with given initial speed.
  •  Custom gravity.
  • Add random deviation.

Number of Blueprints: 3

Network Replicated: Not Tested

Supported Development Platforms:

Windows: Yes

Mac: Not Tested

Documentation:

https://docs.google.com/document/d/1XIOBym7o-id7zgsD-Yacw2zYyYWn_1HG/edit?usp=sharing&ouid=100838755932631478450&rtpof=true&sd=true

9.58 
Platforms Windows 64-bit, Windows 32-bit, iOS, Android
UE Versions 5.0 - 5.1
Tags BLUEPRINTS
Release date 30.06.2022

Similar products

Image
Sign In
Image
Sign Up
Image
Recovery