I know there are a lot of fourms about this but none of them helped. I want my character to only jump once but I cannot use a character controller because it doesnt work for me here is my code `using UnityEngine;
using System.Collections;
public class PlayerMovingScript : MonoBehaviour {
public float Acceleration = 10;
public float maxSpeed = 10;
public Vector3 jumpSpeed;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
{
if(transform.position.y > 2 && Input.GetButtonDown("Jump") )
rigidbody.AddRelativeForce (jumpSpeed, ForceMode.VelocityChange);
}
var curSpeed = rigidbody.velocity;
curSpeed.y = 0;
if(curSpeed.magnitude < maxSpeed)
rigidbody.AddRelativeForce(Acceleration,0,0);
}
}
`