Download

Best Approach for an Automatic Turret?

I’m trying to create a turret that will track a “Target Point”. Let’s say the Turret is a Component to an Actor, such as a tank’s body. What is the best way to tell to rotate and follow the Target Point at a realistic speed? I couldn’t find a “LookAt” blueprint option. I’m guessing some form of utilizing the “Forward Vector” and “Set Relative Rotation”. But not sure how to have it aim at the “Target Point”.

I also I calling the target point with a simple "Get All Actors of Class (Target Point) and a “Get” node.

Any suggestions?

You could try something like this:

turret.jpg

Cool, I’ll give that a shot! Thanks!

There is good turret tutorial:

So I followed this tutorial on youtube - https://youtu.be/XXGWjaRs4zs

Works great! But I have a question about it. How can I set this up to lead a target or predict a target’s path? You’ll notice in this tutorial the turret always shoots behind a moving target because it can not load the target. Any solution to this?

Also, How would I set it to only fire when aligned to the target? Right now this setup will start firing before the turret is facing the target.

Nevermind, I solve the “fire when aligned to the target” issue by using a “InRange” float and setting a +3 and -3 Degree range for the guns to have permission to fire at the target.

Now I just need to solve how to adjust for the target’s velocity. I am assuming I need to get the target’s velocity and somehow tell the aim to add in rotation degrees based off the velocity?