- Home /
Can anyone reproduce this bug in the standard assets first person controller?
There is a bug with the First Person controller that comes with the Standard Assets. When you press jump in air you will start jumping as soon as you land which feels weird. Can anyone reproduce this or is that the intended behaviour?
Steps to reproduce:
-Create a new project -Import standard assets characters pack -Drop FPSController into scene -Jump or drop off ledge so you are in air -press jump button while still in air -character should jump as soon as landed which feels really weird
Unity Version is 5.3.5f1 btw
Answer by allenallenallen · Jun 06, 2016 at 11:06 AM
That's an intended feature. You would know that if you actually looked at the code.
There's a boolean that becomes true whenever the user press the Jump Button.
if (!m_Jump)
{
m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
}
Then the script checks to see if this boolean is true whenever the character is grounded.
if (m_CharacterController.isGrounded)
{
if (m_Jump)
{
m_MoveDir.y = m_JumpSpeed;
PlayJumpSound();
m_Jump = false;
m_Jumping = true;
}
}
The result is that the player can press the Jump Button at any time, and the character will jump the moment it lands.
Answer by chhetling · Aug 02, 2017 at 11:47 AM
there is an easy fix, change
if (!m_Jump)
{
m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
}
to
if (!m_Jump && !m_Jumping)
{
m_Jump = CrossPlatformInputManager.GetButtonDown("Jump");
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612082347im_/https://answers.unity.com/themes/thub/images/avi.jpg)