Download

Check if character is on screen - with other objects blocking visual?

So I’m in a bit of a bind - trying to figure out a SCP-173/Weeping Angel-esque enemy that doesn’t move when the player has the enemy inside the screen space. I’ve figured out how to do that using Convert World Location to Screen Location and a bit of math, but there’s still the problem where walls don’t come into play with this system - i.e. even if there’s several walls between me and this enemy, it still doesn’t move if it’s inside the screen space. Is there a way to check if the character is currently being rendered on screen, or if the character’s simple collision mesh is currently rendered on screen? Any help would be greatly appreciated!

What if, when the check to see if the object is in the Player screen space, you do an async multi-sweep from the object to the player character? Have the callback function check to see if the collision data contains the player. If not, set it to a state where it can be active. If the player is in the collision response, don’t allow it to be active.

What about old fashioned line trace? If your actor is skeletal mesh you could do trace from camera location to each bone. Ofc. after doing math to check if actor is in camera cone of view. I think tracing every bone makes very little room for errors.

Hey,

There is an answer to a similar question posted here. I believe the blueprint for it was also provided. I hope that this information helps.

Link: When Player see Enemy inside camera - UE4 AnswerHub

Make it a great day