using UnityEngine;
using System.Collections;
public class MovePlayer : MonoBehaviour {
public Vector3 speed;
private Rigidbody rb;
private float moveH;
private bool jump;
private Vector3 velocityChange;
private float rGround = 1.0f;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody> ();
speed = new Vector3(10.0f,0.0f, 0.0f);
}
void Update(){
moveH = Input.GetAxis("Horizontal");
jump = Input.GetButtonDown ("Jump");
}
// Update is called once per frame
void FixedUpdate () {
velocityChange = moveH * speed - rb.velocity;
rb.AddForce (velocityChange, ForceMode.VelocityChange);
if (Physics.Raycast (transform.position, -Vector3.up, rGround) && jump) {
rb.AddForce (new Vector3(0.0f, 90.0f, 0.0f), ForceMode.Impulse);
}
}
}
После прыжка, персонаж опускается еле еле. Масса 1. Гравитация -9. Что я делаю не так?