I’m a beginner in Unreal Engine and I would really appreciate it if you could explain this clearly.
I’m trying to make a system where if the enemy AI touches the player (me), the camera switches to another camera view. I’ve added the overlap logic in the enemy AI blueprint, specifically using the Capsule Component’s OnComponentBeginOverlap event.
However, even when the AI gets really close to or touches the player, the camera does not switch.
Instead, the camera does switch when the AI touches other objects like doors or box collisions, which is not what I want.
I only want the camera to switch when the enemy AI overlaps with the player character — not with other objects like doors.
How should I modify the blueprint nodes to make sure the camera only switches when colliding with the player character?
Could you expand on that? You also have a box collision on the enemy character and can’t get it triggered? If so, would you mind sharing a screenshot showcasing how you handle that as well? If you don’t handle it yet, you’ll need to get the On Component Begin Overlap (Box) node and check if it overlaps the player character the same way.
Btw, if the two characters cannot go through each other, their capsule components will never overlap. You can use the On Component Hit node to check if they hit each other tho. (Keep in mind that in order for that to work, both components should generate hit events.)
Or, you can keep your current setup and add a collision (sphere, box, capsule) to the player character that extends out if its capsule component, and that way the enemy will be able to detect the player.
I’m creating a game where the player (a Third Person Character) is being chased by an enemy AI (BP_Enemy). When the player gets caught by the enemy, I want the game to switch to a camera called “Enemy Camera” (attached to the BP_Enemy), showing a close-up of the enemy’s face filling the screen. After that, the game should trigger a Game Over sequence.
Constantly check the distance between the two characters.
Add a collision shape (sphere, cube, or capsule) to the enemy character and check if it overlaps with the player character, or vice versa. (We went over how to achieve this one, just use a collision shape instead of the capsule component.)
Add a collision shape to the player character and check if the enemy’s capsule component overlaps with it, or vice versa. (Explained this one too, you leave your current setup as it is and just add a collision shape to the other character, in this case the player.)
Do a sphere trace on the enemy character’s location and check if it hits the player character, or vice versa.