How do I apply gravity, but only in the y-axis?

In Unity, the gravity feature located on a Rigidbody does indeed apply an acceleration in the y direction on an object, but for some reason it also applies air resistance. It’s like it slows the object in the x and z directions. I was wondering if there was a way either through scripting or even just through some fines in the inspector that can help me get a rigid body to only be affected on the y axis.

In terms of scripting you could put this line of code in your update function:

rigidbody.addForce(new Vector3(0, gravity, 0));

Remember to make gravity a negative value :wink:
Also rigidbody needs to be a variable with the rigidbody you want to apply the force to as a value. If you don’t know how to do this put this in your start function:

rigidbody = this.gameobject.GetComponent<Rigidbody3D>();

You can change global gravity settings Edit>ProjectSettings>Physics also knows as the Physics Manager.

You might also be thinking of Drag that is slowing down your Rigidbody. Make sure it is set to zero so it won’t slow down. Also maybe see Friction?