Target Soft-Lock.

Hey guys, Just wondering if anyone knows how to implement a soft-lock feature?
So when the hit location of my weapon linetrace overlaps an actor (AI) it will lock onto it, but not so that I have to press a key to get off the lock.

A perfect example is GTA V’s aiming.

Can’t seem to find this in any of the forum posts.

Thanks as always :)!

Haven’t played GTA5 yet (god **** pc release…), but you mean the lock will wear off as soon as you move the mouse again?

I guess you will want to trace each tick and if you hit something that is an AI Actor, you will get a reference to it and set the rotation of your controller (depens on your setup though)
to the direction of “AI.Location - Player.Location”. This will give you the direction vector. I would handle this with a bool that is set to true as long as you want that soft lock to happen.
And as soon as you hit the point where it should stop locking on the enemy, you just change the bool to false.

Make sure you don’t use a null reference of that AIActor in some way (like using it without hitting something).