Overlap Event Generation

I am trying to create an auto-aim feature where when a player presses the rmb, actors that overlap inside a collision box in front of the camera are chosen as candidates for auto-aiming.

224880-noclick.png

Here is what should happen:

  1. Player presses and holds mouse button

  2. A collision box (UBoxComponent) that is attached to my camera checks for all the currently overlapping actors

  3. Camera adjusts to keep tracking the closest actor to the crosshair

I am stuck in step 2.

The way I’m doing it is when the button is pressed, I set the UBoxComponent’s bGenerateOverlapEvents to true.
However, it doesn’t generate overlap events until I move the box around (by moving the camera that it is attached to).

(The reason I’m doing it this way is because I want to limit the distance for the auto-aim.)

Why aren’t my overlap events happening until I move the box slightly?
Is there a better way to do this sort of auto-aiming?

Hey there, afaik you can’t really have other collisions happening in your character other than the capsule collider (i think it gets disabled by the character movement component). As an alternative you can do a box trace, you can check about that here.

Hello,
The overlap event does get generated though.
It’s just that when I set bGenerateOverlapEvents = true, they aren’t generated until i rotate the camera slightly (which will move the box)
After the box is moved slightly, that’s when the overlapEvent gets generated and I am able to grap the 2 npcs.

Btw, the player is the mannequin on the right while the 2 mannequins on the left are the npcs.

See if turning that on the capsule component makes any difference.

The capsule component already has generateOverlapEvents set to true but it’s still only working when the collision box is moved.