widget graphic for Velocity ?

Hi , i would like to make a widget to see the velocity in graphic like this :

I noticed this

it’s not realy what I want , I mean it doesn’t help me much, I managed to display the speed value numerically but I want it graphically and I don’t know much about UE4 but here is my blueprint

How about this?

He actually tells you how to do it…

You could absolutely do it with draw lines (in widget’s paint, in material or in the HUD class even) but it may become cumbersome to manage as it grows in complexity, annoying to refactor. That would be a cool exercise, for sure.


You could have a look at the math hall and familiarise with the way materials can visualise function graphs:

Namely:

image

The widget can then display that material. That’d be a very efficient albeit math heavy approach.


You could get cheeky, though, and keep adding elements to a scroll box:

Above, I’m sampling the player’s velocity every .5s, create border widgets with a specific height and push them into a scrollbox, scrolling to the last element with each push.

Seems like it’s worth exploring for something developed rapidly that needs virtually no upfront investments. A crude example:

To make it more efficient over time, use List View instead of a Scroll Box.

Here’s an old piece of mine

  1. create new widget

  2. set up a bunch of variables :

  • GraphPoints : array of Vector2D to store X,Y points
  • Duration : the amount of time shown on graph (eg. show velocity graph of past 5 seconds)
  • MaxFps : the maximum sampling rate (eg. 10 points per second, multiplied by 5 seconds = 50 lines to draw, keep performance in mind)
  • Width, Height : size of graph (eg. 400 x 200)
  • MaxSpeed : size of the Y axis (eg. 1500)
  • LastIndex, FVel : just some local cache variables
    image

Initialize all the points at the bottom-right-most end of graph, and start timer

On timer get current velocity and update the graph points

Then override the OnPaint function for your widget to draw lines

With the help of plugins “UMGPolygon” and “UMGSpline”, you can draw graphs conveniently in UMG.

Marketplace Url:
https://www.unrealengine.com/marketplace/en-US/product/umgpolygon

https://www.unrealengine.com/marketplace/en-US/product/umgspline