i don’t want use add-force because when button up the object still going and when i use velocity the gravity effect will decrease and need nearly 5 s to come back to the ground with velocity so how i can use velocity without effect of the gravity or how i can move my player and stop it when i up the button?
thanks to your help.
this code i used :
Rigidbody rb;
float x;
float y;
float z;
public float speed=5f;
void Start()
{
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
x = Input.GetAxis("Horizontal");
y = Input.GetAxis("Jump");
z = Input.GetAxis("Vertical");
rb.velocity = new Vector3(x * speed,y*speed, z * speed);
}