Rotate camera if player is about to go out of its view?

How can i check if my character is inside my camera view or not ? so that i can move/rotate camera before its about to get out of its view? i only want to rotate camera if “character” is about to go out of view. not after it gets out of view?

Any clue would be very helpful. cuz i have no idea how can i do that…

thanks!!

39169-untitled-1.jpg

I tried attaching a box on the left and the right side of camera to get event overlap to rotate camera. but its not working as i wanted… its been two days and i am stuck… please help!!

c’mon anyone ?? its been 6 days now…

No one answers because the answer is too simple and only requires math education.
Get the rotation vector and rotate if the vectors mins/maxs are out of the desired bounds.

With blueprints its simply use the (Not Equal) node:

Here is my full blueprint which tells you if an actor is out of the camera’s bounds:

Also you have to use the Set Control Rotation node to set the rotation or your character won’t move? But it depends on your setup!

thanks! but how would i do that… can you explain in details ??

I updated my answer.

An another possbile solution is to use:
ConvertWorldToScreenLocation

You are genius… thank alot :slight_smile:

thanks, i’ll try to work with this one as well.

one question though… how would i know that my player is going out of the camera view toward the left or the right? its giving false on both side right now i dont know which direction to rotate my camera because of that?

alright i figured! i just had to check if “find look at rotation” Y rot rotation was positive or negative…!! :slight_smile:

hmm… it worked in first time and after changing rotation of camera its not working… what would be the right way to do this?

You don’t have to know which direction: left or right. You have to know the rotation. And you know it, just rotate your camera using the output rotator, the one calculated from the 2 points.

yup worked! i thought i’ll have to rotate camera manually by some degree… but now its much easier after doing what you said.
thanks again for your clean and clear replies :slight_smile: