How to show current vector in UI

I would like to display a static mesh’s current vector in the UI. For example, in a 2d environment, the mesh is drifting to the right, the camera looks left and does not see the vector indicator. When the camera rotates back to the right, in line with the vector, the vector indicator comes into view.

I am able to get the screen positions on tick in the pawn’s blueprint, but I am unable to get them in the UI’s blueprint. It seems to just set the location once and not continue to update the variable.

Cast to

Has it’s problems if you use it too much but if your just learning or making a concept of the game not the worst way to get your location

that said if its the characters HUD just do Method 2

In method #1 you’d have to choose the appropriate cast to and object if not Character

Welcome to the forums btw don’t forget to mark as answer if is answer

This doesn’t seem 100% what your looking for but we’ll need slightly more information preferably picture of setup and viewport

^ Forgot to mention keeps it loaded added this in case it gets marked as answer

FYI, casting can be expensive because they load the entire BP and you might want to (at least if you’re planning to release or your project is pretty large or memory-intensive) switch to using Blueprint interfaces (for instance using a function called “get Capsule Component World Location”) because this will save a pretty significant amount of memory if your character mesh is dense or something else the character BP has loaded is heavy.

1 Like

The unmentioned Method 3 :sweat_smile:
Couldn’t have said it better myself and i definitely should have explained it keeps it loaded
Interfaces are a bit tough to understand if your newer but 100% you’ll have to at some point

So, I tried the player character to world location of the capsule component, it is returning 0. The attached image is how I am getting the X and Y values I would like to have an image presented at in a UI, variable vector X Y.

Using something like the following I can get is to set the location once in the UI, right when the pawn spawns, but it does not refresh. It just spawns and stays at that world location.

Progress, I got everything working, kind of. It is being slotted to right and down. The following is the pawn bp.

the following is the UI bp

the following is a screen shot of the image location. the >< is the image

the yellow and orange numbers are the screen size
the green and blue numbers are the numbers being sent to set position node, where the image is supposed to be.

I think it is a problem with the canvas panel not matching the location on the screen.

Answer: I created a new hub that creates the widget on play and assigned it in modes and maps

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.