I'm still new to unity and I'm trying to create controls for a hot air balloon, however even though I'm still holding down the up arrow the object ends up falling after a few seconds and I'm not sure why.
if (Input.GetKey(KeyCode.UpArrow))
{
transform.position = new Vector3(0, 1, 0) * Time.deltaTime * speed;
fuel = fuel - 3 * Time.deltaTime;
}
CodePudding user response:
When you say that the object is "falling" I take that to mean that you've added a Rigidbody (or Rigidbody2D) component to it with gravity enabled.
If you're using a Rigidbody to simulate gravity, you can't just manually manipulate the position like this. You'll want to use Rigidbody.AddForce() instead.
