So this is the script and I want to be able to boost my speed with a press of a button for example "Jump",Can't increase my movement with GetbuttonDown
private Rigidbody rb;
public float speed;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate () {
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3(moveHorizontal, 0f, moveVertical);
rb.AddForce (movement * speed);
if (rb.position.y < -1f)
{
FindObjectOfType<GameManager>().EndGame();
}
},
Comment
Your answer
Follow this Question
Related Questions
Jumping cancels out x and z velocity. 0 Answers
Rigidbody.AddForce moves in a curve 1 Answer
Change direction of rigidbody when force is no longer being applied 2 Answers
Time.deltaTime doesn't help on different devices! 0 Answers
Is there a way to "rotate" the direction of addForce (without using addRelativeForce)? 0 Answers