# Limit horizontal movement of player in what camera see

**URL:** <https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [March 6, 2015, 2:25pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614 "2015-03-06T14:25:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![posteros\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@posteros\_1](https://forums.unrealengine.com/u/posteros_1)\
**Post date:** [March 6, 2015, 2:25pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/1 "2015-03-06T14:25:02Z")

</div>

Hi i am trying to make a game like doodle jump but i cant get the player to move only in what the camera sees in the horizontal.I want the player to move from the one side to the other and not out of what my camera see.

Any help would be great.

Also if you know how to make the player to teleport when i goes to the one side and to come from the other

 ![32674-screenshot00001.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/d/b/9db3f40da1f5450c63b6afbc147baf7688dd7465.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_741503d3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_741503d3](https://forums.unrealengine.com/u/anonymous_user_741503d3)\
**Post date:** [March 6, 2015, 3:35pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/2 "2015-03-06T15:35:24Z")

</div>

In a setup like this you can just calculate your boundaries in world space and then whenever you update your character’s position you check where he will be after that update and if he is out-of-bounds then you can either stop him (aborting the update) or set his new location (on the opposite side of the screen) by hand, because you know his current location and you know the screen bounds so it’s really easy to calculate everything you need.

---

<div class="post-metadata">

**Author:** ![posteros\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@posteros\_1](https://forums.unrealengine.com/u/posteros_1)\
**Post date:** [March 6, 2015, 3:58pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/3 "2015-03-06T15:58:48Z")

</div>

Thank you for your anwer i will try this right away.Sorry for the noob question but how can i make the object he jump on being generated automatocly so that i can make the game be endless

---

<div class="post-metadata">

**Author:** ![posteros\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@posteros\_1](https://forums.unrealengine.com/u/posteros_1)\
**Post date:** [March 6, 2015, 4:39pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/4 "2015-03-06T16:39:34Z")

</div>

Could you give an example in blueprint if it is possible

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_741503d3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_741503d3](https://forums.unrealengine.com/u/anonymous_user_741503d3)\
**Post date:** [March 6, 2015, 5:16pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/5 "2015-03-06T17:16:37Z")

</div>

Sure, though I don’t have access to engine right now, but I will post a picture of such setup when I have it.

---

<div class="post-metadata">

**Author:** ![posteros\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@posteros\_1](https://forums.unrealengine.com/u/posteros_1)\
**Post date:** [March 6, 2015, 5:20pm UTC](https://forums.unrealengine.com/t/limit-horizontal-movement-of-player-in-what-camera-see/309614/6 "2015-03-06T17:20:57Z")

</div>

Thank you thar would be great 🙂
