Category: Unreal Engine 5

Categories
Game Design and Development Unreal Engine 5

Toggling cursor visibility, mouse capture mode and locking to a viewport inside of Unreal Engine 5 via Blueprints

I will be honest, I feel like in Unity you can easily Lock, and Unlock your cursor but I really struggled for a while with this issue inside of Unreal Engine 5. I looked all over the web using search terms like “UE5 Lock Mouse to Viewport Issue”, “UE5 Show Mouse Issue” and of course switching out the term “issue” with “problem”. I did find a lot of posts out there but most of them only solved for one part of the problem. I believe I have figured out solutions to the issues I was running into. I even made a video talking about the solutions, but I also have gone ahead and written this article to help those who just need a refence point or for those who have watched the video and want stills of the Blueprints.

Fill free to watch the video on YouTube or stay on this page watch the embedded video.

If you don’t want to watch the video you want to have visual reference, I have broken down the blueprint below.

Here is the whole function end to end that I placed in the level blueprint.

Blueprint how I was able to Show/Hide Mouse Cursor Toggle while disabling camera control from mouse movement.

First, we have a trigger event you can have assigned to a key or button on a gamepad.

Next, we have a flip flop which will do first trigger the “A” path the first time that trigger event is fired and then the next time it is fired it will go down the “B” path. You will notice in both paths and all functions in these paths we are always targeting the same player controller.

Using SET we can show or hide the mouse. Since when the game runs our mouse is already hidden, we know that we want the first time someone triggers the event for it to show the mouse.

Next, you will notice that for path “A” we are setting the input mode to both game and UI. The reason for this is so that the mouse can be listened for on both UI objects and the game world objects.

Lastly, we have the look input function either ignore the mouse data or reset.

Categories
Game Design and Development Unreal Engine 5

Adding Camera Zoom Controls in Unreal Engine 5 via Blueprints

This is my first tutorial video on Unreal Engine 5. I have been learning Unreal Engine 5 myself recently and so I decided to make this tutorial showing the easiest way I have figured out how to add zoom to the camera of a pawn using blueprints.

Fill free to watch the video on YouTube or stay on this page watch the embedded video.

The rest of this article is some notes for reference later if you need after watching the video.

Example of Blueprint for testing the output of the mouse wheel axis only when it is being used.

Example of Blueprint for testing the output of the mouse wheel axis only when it is being used.

Example of Blueprint of the zoom controls with some reminders.

Example of Blueprint of the zoom controls with some reminders.