Set Player Start location on Mini-Map with mouse cursor

Hi!
How can I select where to spawn my character with the mouse cursor on a minimap?
I need that the X and Y axis of the cursor on the minimap correspond to the X and Y axis in the level map.
Is it possible? Thanks

you can get your mouse location using the player controller.

Depending on your level size, a minimap wont be enough to get you a exact coordinate of the location.

Thanks for the reply,
the level is quite big, but I don’t need a super precise position.
So can I get the mouse location on a minimap set in a widget blueprint?

Since you’ll be using a widget, I’d suggest you use its geometry for this instead - so you do not need to make additional calculations in case your map is not full screen and does not match viewport size. Player controller returns viewport coordinates.

You said mini-map so I’m assuming it’s not full screen :slight_smile:

Let’s say the map is 256x256 and tucked away in the upper right corner. The only thing you care about is where the cursor’s at in that 256x256 space.

edited: you can use the Map Range to output translated world coordinates this way. (providing the minimap shows the entire world…, otherwise things get complicated).

Now, as SupDeity observed - this is not going to be very accurate unless you allow the player to zoom in. Or place minimap spawn markers that know the precise spawn location in the world.

Yes it’s not fullscreen :slight_smile:
Good, it seems to be the right way to do it, I’m gonna try, thanks!