Look at actor with limited Movement (Aiming)

Hi there,

In my project one of the mechanics I have setup, is when the player aims his weapon, he automatically targets the enemy and stays targeting him as long as he is aiming. What I am trying to do though is have the users mouse movement limited. So while he looks at the enemy, the player still be able to move the crosshair so that he can aim for his head, or other parts of his body. And finally, when the player moves the mouse further, the crosshair detachs from the enemy. Any ideas how I can get about implementing this “assisted aiming mechanism” is greatly appreciated!

Best,

I would think adding a invisible target on the enemy’s head and then using a look at node to consistently reference that would do the trick.

put it in a function that checks how far away your cross hair is from the invisible target and when it reaches a certain point activate the look at to make the cross hair snap to the invisible target and then shut it off until it has left and reentered range again.

Something like that.

Hi Exonfluxx,

I tried it out and it worked! My only problem is I am trying to add the mechanic where the crosshair locks on to the character but the player can still have limited movement with the aim to choose which part of the body he wants to shoot at (ie: head, arms, etc.) I tried it by clamping the angles with a +10/-10 degrees. But the problem is that the code isn’t clean. It runs every 0.01 seconds but conflicts since it first looks at the target component and then registers the adjustment. Any ideas?