Multiplayer FPS player can fly up infinity.

Updated on March 30, 2018 in [A] Brackeys Courses
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
4 on March 28, 2018

If I hold down space my player can keep flying up and wont go back down. I am using Unity 2017 version

  • Liked by
Reply
0 on March 29, 2018

Do you have anything that tells the player to fall down?

or anything to check if they are on the ground before they can jump?

 

  • Liked by
Reply
Cancel
0 on March 29, 2018

Can you give us more information? Code for example where you register the spacebar button and the functions you call when the spacebar is triggered?

 

  • Liked by
Reply
Cancel
1 on March 30, 2018

if (Input.GetButton(“Jump”))
{
_thrusterForce = Vector3.up * thrusterForce;
SetJointSettings(0f);
}else
{
SetJointSettings(jointSpring);
}

// Apply the thruster force
motor.ApplyThruster(_thrusterForce);

 

That is where my input for Jump is, However Mouledoux you are correct I don’t have anything that tells it to go back down. 

on March 30, 2018

I’m not sure exactly how you have the player set up, but you may just need to add a rigidbody to get gravity, however you may have set it up to avoid using rigidbodies.

 

Either way, you still might want some kind of “foot” collider to tell them that they are on the ground. Then you can use that to:

  1. make sure they’re on the ground before they jump
  2. stop pulling them down once they hit the ground

 

Show more replies
  • Liked by
Reply
Cancel