public class Move : MonoBehaviour {
private Rigidbody rb;
public float speed = 10;
public bool jump = false;
public float jumpUp = 0;
// Use this for initialization void Start () {
rb = GetComponent<Rigidbody>(); } // Update is called once per frame void Update () { }
// Update is called once per physics calculations
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Mouse X");
float moveVertical = Input.GetAxis("Mouse Y");
jump = Input.GetButtonDown("space");
if (jump == true)
{
jumpUp = 10.0f;
}
Vector3 movement = new Vector3(moveHorizontal * speed, jumpUp
* speed, moveVertical * speed);
jump = false;
rb.AddForce(movement);
} }