Whenever I try to compile my code I keep getting this error and I’m not sure what the problem is because the statement for the binding and the function match
I’ve added both my Character’s header file and cpp file as well as a screenshot of my inputs for reference
Your “CalculateJumpHeight” function signature is different from function(float) as expected by the delegate passed to “BindAxis”. Your function’s signature is function(float, float).
If I’m following correctly what you’re trying to do, I’d suggest making some changes to your implementation.
“CalculateJumpHeight” will be constantly called when the “Jump” key is pressed. Is this actually what you want?
If not, I’d suggest you rather use “PlayerInputComponent->BindAction” on a new “Jump” function and ensure that this function’s signature is function(), i.e. without parameters. Then, in your “Jump” function you can calculate the gravity & height variables, e.g.
float const gravity = someOtherFunctionThatDeterminesYourGravity();
float const height = someOtherFunctionThatDeterminesYourRequiredJumpHeight();
float const jumpHeight = CalculateJumpHeight(gravity, height )
I’m not quite sure how you are expecting this to work so please feel free to add more details and I’ll have a look.
Try adding '#include “Components/InputComponent.h”. That made it work for me when I had this problem.