Is it possible to have a different rigidbody drag value for each axis?

Hello everyone,

I am currently making a first-person dynamic rigidbody-based movement system for my 3D game. So far, I have been using the default Rigidbody.drag property to handle drag. Cranking it up is a quick way to fix that slippery movement we all dread, but it simultaneously causes a lot of other issues.

For example, if you try to jump up with a very high drag value, the player will basically teleport into the air (assuming you also crank up the jump force) before slowly falling back down like a feather. At that point, even gravity starts to feel like it’s constant instead of accelerating. I guess a solution would be to only apply drag to the x and z axis, and set the drag on the y axis to zero or a very low value.

I know it’s not possible to directly change a rigidbody’s drag for each axis because it’s a global value that affects every axis equally, but is there a way around this? I love the simplicity of rigidbody drag, but I want to disable it just for the y-axis so that the player can jump and fall normally. If this is straight up impossible or just a very bad thing to do, I guess I could make my own custom drag system, but I still want to find a way to mess with rigidbody drag.

To have different drag values in each axis would just involve handling the movement dynamics yourself, rather than relying on rigidbody physics entirely.

You can still use a rigidbody, but you would be setting the .velocity property, or using Rigidbody.MovePosition() after calculating your own movement values.

1 Like

You can also change the gravity. Rigidbody2D’s give you the option to change it in the component. To change it globally, which would effect all Rigidbodies, including standard ones, you can change Physics.gravity.

1 Like

Now that I think about it, I can just lower the speed with which the player travels in the air to compensate for the low drag value since the issue with just setting the drag to a low value in the air was that the player would glide around really fast. How did I not think of this in the first place? Sometimes I’m just -3 IQ lmao

As someone who has done this recently I would suggest that you ignore both the built-in gravity and the built-in drag. They will cause more issues than they are worth and writing your logic for both will not only give you more control but also likely take less code than if you tried to force workarounds in. Your best bets are what spiney199 suggests about writing your own custom drag. You can also use tricks like changing the physics materials used by your character’s collider(s) based on states like input and whatnot.

1 Like