# Check Actor within Screen/Camera Boundaries

**URL:** <https://forums.unrealengine.com/t/check-actor-within-screen-camera-boundaries/1136954>\
**Category:** Blueprint\
**Tags:** unreal-engine, question\
**Created:** [April 22, 2023, 3:18pm UTC](https://forums.unrealengine.com/t/check-actor-within-screen-camera-boundaries/1136954 "2023-04-22T15:18:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kcrik](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kcrik](https://forums.unrealengine.com/u/Kcrik)\
**Post date:** [April 22, 2023, 3:18pm UTC](https://forums.unrealengine.com/t/check-actor-within-screen-camera-boundaries/1136954/1 "2023-04-22T15:18:15Z")

</div>

Hello Guys,

I have been scratching my head a bit with that one. I feel like it’s a trivial one to do:

“Making sure you’re actor stays within Camera/Screen boundaries”

What I have tried is:

- Get the offset I want to apply from keyboard or gamepad
- Get the actor World location, and add that offset
- Use the node Convert World Location To Screen location
- Check X/Y are superior to 0,0 and are lower than the X/Y returned by the Node Get Viewport Size.
- It seems to work for top, left and bottom (with some gap), but checking the right border doesn’t seem to work.

I have attached screenshots to illustrate the issue.

So I have a couple of questions:

1. Obvious, but do you have a clue why it’s behaving like that: gap and the right border issue
2. Is there a better/more optimised way to make sure your actor stays within boundaries (Which I assume is the Viewport, but seems to not be the case)
3. Is it because the camera is Perspective that I get this weird behaviour or because the way to do this check should be done in a completely different manner.

I used to work more on 2D games, so it was more or less how I would do it. Sorry if that was dumb.

Thank you,

Chris

 ![LeftNoGap](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/5/d55206a2d2c6be2265690ef74b9ac7be9af6c387.jpeg)  
 ![RightNotWorking](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/f/9df1a6b211515b764248cec17f27c6cad46e246b.jpeg)  
 ![TopGap](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/f/c/3fc6b7d10e8b16c87393c4d9fc5770520e136211.jpeg)
