how to make a flashlight like this?

Hi, I’m new to ue5, so I’m asking for your help.

I would like to recreate a flashlight like in this video(6:50):

I like that the camera doesn’t follow the flashlight completely. If you have any ideas on how to implement this, I would be very grateful. Thank you!

Hey @oksalvol!

I have some ideas!

Firstly, there are lots of basic flashlight tutorials out there, try to find one that works for you as a jumping off point.

Next, you’ll definitely have to disconnect the camera controls from the mouse movement on the player blueprint. It looks like the player only moves the camera when the flashlight is attempting to move further than the edges of the screen… If you’ve ever played any RTS games on PC, you know you can usually move the camera by touching the edges of the screen with the mouse? That’s what’s going on here.

The flashlight origin starts at a point above and to the right of the player’s camera, and is aimed towards the current mouse location in world space, giving a vector (direction) to point the light. Turning involves pushing the mouse against the edge of the screen, if you can find a tutorial for an RTS camera doing that, which would normally change the location of the camera, you can likely replace that with ROTATION instead!

It’s a combination of several systems used in a unique way, let us know if there’s more we can do to help! :slight_smile:

1 Like

Thank you very much, now I’ll go read the manuals and try to implement it

The documentation helps but getting your feet wet is the fastest way to learn, and following tutorials is the fastest way to do that without getting overwhelmed- you don’t want to get distracted by other systems constantly, and a tutorial will help narrow the focus.

Maybe start with this one to get things rolling!