How do should I check if both of my actors are looking at eachother?

Hi, I’m making a small indie fighting game demo to learn how to code games, I’ve been having trouble coming up with ideas on how to check if my characters are looking at each other. Is there a way to check if the forward vector of one of my characters is looking towards the collision box of another character?

The game is in a 2D plane if that helps.

Hi! In this case you can use linetrace! All you need for that is that line of code

world->LineTraceSingleByProfile(OutHit, actorLocation, actorLocation + distance * actorForwardVector, ProfileName, collisionQueryParams);

or this

world->LineTraceSingleByChannel(OutHit, actorLocation, actorLocation + distance * actorForwardVector, TraceChannel, collisionQueryParams, collisionResponseParams);

actorLocation, distance, actorForwardVector - rather obvious. You can use collision profile or trace channel to make linetrace more optimized and fast. In query params you can add actors to ignore and smth like this.

than just got it to work finally after many hours of learning about collission