Line trace lock on
Is there a way to get a line trace to lock onto a target. I have a turret that I control with a line trace attached, I want to be able to control the sight, but once my target lines up with the crosshairs (line trace) the way I like, I press a button and the turret then auto locks onto the target and follows it. My turret is elevated pointed towards the ground where the targets are (all targets are moving towards the turret, never away)
Also, for extra credit, can a line trace do some math and let me know the angle (in degrees) from the turret to the ground target? Since the line trace would be locked on, the angle is constantly updating the degrees smaller and smaller until the target is reached. I'll need to use that data for certain functions later on.
asked Jun 27 '18 at 08:49 PM in Blueprint Scripting
for the lock on all you really need to do is on button presses do a single line trace and take the hit actor and assign it to a variable. then have another function that sets the rotation of your turret to the look at rotation between the turret and the target.
the setup in this picture should help get you started.
Follow this question
Once you sign in you will be able to subscribe for any updates here