How to make progress bar fill at rate when button pushed and then get percent (UMG HUD)

Standard Model-View-Controller

The Model is the value of the golf club wind up in percent and is a variable on the golf club (or player maybe). That is where you start.

The View is the progress bar graphics. It gets updated from the Model.

The Controller is the button you are pressing. It changes the Model value.

So you don’t get the value from the HUD progress bar. You keep your value in the golf club and set the progress bar.

Model View Controller here

Hello,

I am trying to make a minigolf game currently (starting using the rolling demo) and having some issues with HUD. I UMG hud

I am trying to make a power bar that uses progress bar. It is supposed to on space bar press start filling up to 100 then take that value (do some multiplication to make it a larger) and apply it as an impulse to the x vector. I have the basic set up for a umg hud which I will show images of. I want to make the progress bar fill at a set rate when the spacebar is pushed and the when spacebar is pushed again it should stop filling and take that fill amount and set it to a variable.

46173-capture2.png

Okay I think I understand what you mean. However, currently we are not using a model to hit the ball. We are only using ue4 add impulse to the x direction.

I also do not understand how to do the model has the value.

So you have a player and they push the button to wind up the swing. In the Player blueprint you have a Variable float that is the windup. Each tick if the key is held down you add some amount (per second) multiplied by the delta time.

Then each tick you set the progress bar.

When they release the key you have the wind up amount and use that to hit the ball.

Sorry for the delay and thank you so much for your help. I have been able to achieve control of the ball by holding down the E key and it applies an impulse; however, this does not show up on my Progress Bar as filling or showing the amount as intended. Can you tell me where I am going wrong with the UMG HUD. Thank you.

I see in Event tick where you are updating the TimerCount which is good, but I don’t see where you ever set the progress bar value?

Isnt setting the powerfill binded to the progress bar setting the progress bar?

Yeah I will change that however, the way the code is written right now it only is showing up hud now only after the e button is released how do I get it to show the progress bar raising?

Yes, a bound variable should work. IS the range right? 0.0 to 1.0 or maybe 0 to 100.0 ?

In the OnTick update the bar.

How do I do that?

So I figured it out now and figured I would share for anyone who was looking for it.

So this code is in my player

In my UMG HUD my progress bar is binded to this code