Answer the question
In order to leave comments, you need to log in
Input in FixedUpdate, different jump strength?
Hello, I googled a lot and realized that this is a common problem, I realized that you can’t use Input in FixedUpdate, but I don’t know any alternatives for my case. I am a beginner and I am making a game for jumping speed, while jumping diagonally, before that I just had Update, but I started to notice that sometimes maybe 1 click out of 100 does not work and it is very annoying, I googled and found a solution in using FixedUpdate and setting Fixed Timestep 0.008333334, I was immediately surprised that the power of the jump became much stronger, in general, I tweaked the power, but now 1 click out of 100 I have a weak jump. Please tell me the solution
private void FixedUpdate()
{
if ((Input.GetKeyDown(KeyCode.A)) && groundDetection.isGrounded)
{
rb.AddForce((leftJump) * force, mode: ForceMode2D.Impulse);
}
if ((Input.GetKeyDown(KeyCode.D)) && groundDetection.isGrounded)
{
rb.AddForce((rightJump) * force, mode: ForceMode2D.Impulse);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question