I am trying to use the URadialForceComponent to create a power up.
(C++ not Blueprints)
However I have run into some difficulties.
The player generates power, which is passed to the power-up and then used as the ImpulseStrength and ForceStrength variables. However when I change this dynamically it doesn’t work as I expect.
For example, when the object is constructed I set a default of 10000.0f and it works great.
However if I change ImpulseStrength and ForceStrength variables to 10000.0f in my “Fire” method, it doesn’t behave the same, i.e. the strength clearly isn’t as strong even though the values are the same…
Please can you let me know if it is a bug or whether I am doing something wrong.
If you print to the screen when the variables are used, how does the value change from being used in the constructor versus being called in the “Fire” method? It’s difficult to get a grasp of how you are intending to use the force component and what effect you’re actually receiving, would it be possible for you to post you code so that we could take a look at what the cause could be.
I have just added an on screen output to show the force and impulse strength.
They are showing correctly however when the force hits an object it clearly isn’t as strong as if I were to hard code a default value in the constructor.
When I charge up, and release I pass the charge to the fire method and set it as:
There are a few questions that may help me understand what is going on for your project.
How are you “charging up” and setting the value of Charge before passing it to the Fire method?
Is there any change in behavior if you set Charge = 1000.f directly and then pass it to Fire? Also, it would help if you could include the code for the Ability::Fire() method to see how Charge is getting used there.
Would it be possible to include a video of the different effects you’re seeing between setting the values in the constructor versus setting them inside the method?
We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.