Download

Change Initial Rotation Based on Toss Velocity

I have an AI turret It has a fixed Launch Speed and end location. Is it possible to calculate Start Location using SuggestprojectileVelocity?I have tried the following thing but it rotates wrongly.


Hi @FinalRockstar
sorry can you explain a bit more about wha you need and why?

Reading your question :
Pretty sure that you cant using that node, because it “Calculates an launch velocity for a projectile to hit a specified point.”
But, if you can only launch a granade, at vector 90,90,400 , and you want to hit the Target,
you can mirror that vector, and fake-launch the granade from the Target, that will give you the spot from where you need to stay.
here the node for Predict Projectile Path By ObjectType | Unreal Engine Documentation
Looking to the image:
You want to rotate that gun on the left , so she aim to the turret?

Hi sorry for the confusing post. Basically what I want is like the target position is fixed and launch speed will also be fixed for the projectile and so using that I want my Turret to adjust it’s elevation in world space so that the projectile hits the desired location.

Ooook , so the turrent need to change the elevation in order to hit a target ,
because cant move, and can only shoot bullt to fixed speed.
Here a cool video https://www.youtube.com/watch?v=yMdQ-W4SiAE
Basically you want to “fake-shoot” using this node, and know if the impact of the fake-bullet is:
Too-Strong or Too_weak. You can get it making a vector with the positions:
Turret_location - Target_location (Get Lenght) , this is the exact distance between the target “X”
Turret_loc - Impact_location (get lenght) this is the distance of the impact, “Z”
if Z is greater than X , you need to lower the turrett,
if Z is minor, than X, elevate the turret.

You can cast this check in a loop for every Elevation of the turrret , OR
Casting cleverly.
for example, start with elevation 22.5 (45° is the max elevation for max distance)
this will split the option in 2, the target is in the 1°half or in the other half.
If you didnt hit, shoot at 11, or 33, based on the greater/minor distance.
and keep halfing the elevation.
When you hit, you know the perfect elevation to shoot with the real-Bullet.

**By the way if you are not usign super complex physics you can bypass almost all,
and search for a simpler way, i am pretty sure that
knowing a bit of math you cant outsmart this stuff **

oh ok I will get back with the results. Thanks for your time

I used the following approach.