Question by 
               davnyk · May 18, 2020 at 08:48 AM · 
                movementmovement scriptmovements  
              
 
              Jumping in my script deosnt work,How make this script to jump?
Script I wrote should make player jump, if there's pressed 'W' (btw it's supposed to make player jump again in air) using UnityEngine;
public class Movement : MonoBehaviour { public Rigidbody rb;
public float sensitivity = 25f;
public float jumpSensitivity = 250f;
public bool inJump = false;
 void FixedUpdate()
 {
     if ( Input.GetKey(KeyCode.W) == false)
     {
         inJump = false;
     }
    
     if ( Input.GetKey("d"))
     {
         rb.AddForce(sensitivity * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
     }
     if ( Input.GetKey("a"))
     {
         rb.AddForce(-sensitivity * Time.deltaTime, 0, 0, ForceMode.VelocityChange);
     }
     if ( Input.GetKey("w") && inJump == false)
     {
         rb.AddForce(0,  jumpSensitivity * Time.deltaTime, 0, ForceMode.VelocityChange);
         inJump = true;
     }
 }
 
              
               Comment
              
 
               
              Your answer
 
             Follow this Question
Related Questions
Continous movement issue 0 Answers
Character Rotation 0 Answers
Movement acceleration 1 Answer
How can I state the movement speed of this script? 0 Answers
Unusual movement script. Any ideas how to do that? 0 Answers