Search code examples
cameraunreal-blueprint

Horizontal Camera Scrolling within given range


I want to create a mobile Game, with only horizontal Camera Movement.
Like a SideScroller without the Camera being attached to an Actor.
I want to let the User only move within the given Range.
I'm using only Blueprints.
Just to make it sure, I really don't want to know, anything about the implemented Camera of any Mobile Device.
I just want my Camera Actor (From Unreal Engine) to behave like a normal App, where you can Scroll horizontal just by "swiping" the finger over the Screen from left-to-right to archieve a movement to the left and swiping from right-to-left to archieve a movement to the right.

Information I need:

  1. How can I move the Camera horizontal by mobile Touch? (similar to Scrolling a ListView/RecyclerView in Android)
  2. How can I just let the Camera move horizontal within the Map or given Range? (See Pic's with Grey Background)

Current Map: Current Map

Current Static Camera View (Shouldn't go any furhter to the left): Current Static Camera View (Shouldn't go any furhter to the left)

Example Camera View (Shouldn't go any furhter to the right): Example Camera View (Shouldn't go any furhter to the right)

Thanks in advance for any helpful advise.


Solution

  • For the scrolling boundaries you could work with a float variable and set its min/max value manually. That way it never extends over those min/max values.

    Or you could use this node instead.

    Also check out this video, might give you an idea on how to implement your swipe mechanic.