How can I manipulate world location through a minimap widget?

Hi. I’m trying to figure out how I can place lights into the world and drag them around from my minimap widget? Is there some sort of way to detect clicks from the world in the minimap? I already have objects that are able to face a point with a vector, and my minimap works just fine, but I’m not sure how I can detect clicks and drags through the widget.

If you skip to 1:15 you can see what I’m talking about. They have a drag-able light and a point it focuses on.

Thanks!

The most basic setup would revolve around translating widget’s local geometry to 3d coords while overriding onMouseMove:

Image from Gyazo

Also, the linked vid is 45s long only. Wrong vid or wrong time.

You can detect clicking on the world map by putting a clear widget button on top of it, and then detecting the cursor location on click. (remember to zero out the alpha on all the button images Normal, Highlight, Pressed, etc.) Then to drag you’ll need to use the Drag and Drop system built-in to Unreal. It has parameters to clip your object within the bounds of the map, drag the object around responsively, and then detect when it is dropped. There is a problem you’ll need to work around to have the drag update in real-time if your mini-map is not a widget, I don’t imagine it isn’t, but heads up tracing into the world on drag is a pain due to input state. This tutorial is goofy named, but seems the best explanation I’ve found on this system. Beyond that it sounds like you have the difficult stuff figured out, translating from mini-map space to world space and accurate HUD waypoints is the tricky bit.

I posted a solution hours ago but it’s pending moderation. It’s a pretty straightforward onMouseMove override where you translate widget geometry into world space.

There’s nothing to calculate.

These are the Unreal Units a.k.a. centimetres. This translates the (lets say) 200 pixels of widget screen-space into 12 meters of world space.

It’s up to you what values to punch in. If your world is 4x4km, you’d want -200k <-> +200k since 1km = 100.000cm - uus.

Clicking on the very left hand side of the widget would place the actor at -2km (Y) from the centre of the world origin.

Thank you! Very useful. But how to calculate “-600 to 600” value? Is it map resolution?

Hey Can you tell me how you got the selected Light part in the above BP. Its those spheres right how to connect them to the WBP. Thanks in advance !

Looks like this was done by overriding onClicked and feeding the reference to the widget. Or by tracing.

  • create a reference variable in the widget
  • get player controller → get hit under cursor → break hit → Actor → set widget’s reference
1 Like

Hello, I want to make a minimap in which i can click on an area and teleport between these fixed teleport locations. how can i do that?

  • place user widgets in a canvas
  • calculate their relative locations in the parent when clicked
  • you know the size of the minimap, you know the relative coords, you know the size of the world
  • use that data to translate the 2d widget coordinate into the 3d world coords


Sir can you help i made this but its not changing town id, for each id theres an array of four locations and the widget has 4 buttons but when i click on widget in vr the town id doesnt change and am stuck at the first town 4 locations

Thanks in advance

  • how are you testing it?
  • does the cast fail?

I dont know if its failing to cast, i attached print string to the widgetBP nothing gets print, also i looked some tutorials they did that press pointer key and release pointer key which i also implemented, am testing in oculus quest 2 the map is hoverable and collision also good but it doesnt click