Edge scrolling script issue

Greetings!

I am VERY new to the game development scene. I work in IT and have been able to translate many of my skills into understand something as daunting as UE5. After numerous hours of watching tutorials and seeing the many ways people use Blueprints to accomplish their goals, I feel fairly comortable with the basics. I still have much to learn and do plan on learning C++ in the future.

I am aiming to make a simple Top Down Tycoon game. I’ve learned how to make some efficient Blueprint scripts for camera movement. I am using the new Enhanced Input Mapping system and currently have these camera movement scripts working:
• WASD camera movement
• Zooming in/out
• Edge scrolling with mouse cursor

The last piece of script I want to set is to utilize the Q/E keys to rotate the view by 45 degrees. I’ve only made a simple input script to test this out, but ran into an issue with the edge scrolling script.
When the camera view changes by 45 degrees, the WASD camera movement still moves the camera in the proper directions with the new viewport orientation, but the edge scrolling script stills moves the camera in the same directions as if the new camera orientation was still in its original state. I’ve included a video clip so its easier to understand what I mean.

The question is, how can I update the proper world position of the camera to reflect which direction the viewport should move when the mouse hits the edge of the screen?

Any help/input I can get is greatly appreciated!

1 Like

It’s because you’re adding the camera offset in world space ( in an absolute sense ). You need to add the offset based on the camera forward and right vectors.

Guess I need to figure out how to incoorperate that into the script. Thanks for the feedback!

1 Like

Well, instead of using just X to go right ( I think it’s X? ), use ‘get actor right vector’, multiply it by how far you want to go right, and plug that into the ‘add actor world offset’.

You’ll need to recombine the pins, because you’re plugging in a vector.

To go forward, it’s the same, but with ‘get actor forward vector’.

Drop me another line if you can’t get it working and I’ll do an example, but I’m not at a machine rn… :slight_smile:

Thank you for the direction! With what knowledge I have gathered and your suggestion, I was able to input the camera vector information and now the edge scrolling works in all directions once the camera angle changes.

I greatly appreciate you!

1 Like

Yes! - very good :slight_smile:

You will go far… :blush:

1 Like

Thanks for that! Figuring this out just based on your suggestion was a big confidence boost! Take care!

1 Like