Linear Damping issue. It should be a vector? XYZ?

So I am trying to make a character move left and right using force and make it pretty rigid.

So doing this all you have to do is put the linear damping to 1 then bam it works as I expect!

BUT when i then put a jump mechanic, it is not as I would like. I’ll jump up to a height that doesn’t seem high enough and I come down at a snails pace. If I put the gravity to be stronger, I can’t jump up high unless I crank that sucker up, but even then the side movements are pretty much useless now.

It seems it would be nice to not have a Universal Linear damping on all axis’ but rather individual xyz damping.

I thought maybe linear factor? but then I realize that linear factor just affects how much forces can be affected by at all by forces so setting these values closer to 0 only makes it so they don’t really get affected at all.

I just want to be able to have more control with linear damping with xyz in mind. OR have a solution to the problem of being able to move left and right with a pretty rigid movement speed, and jump with a more physics based speed.

Thoughts? Suggestions? Help?

You can apply damping yourself to a rigidbody in a script. That should give you the control you need.

Or instead of using forces to move the character, consider setting the velocities directly.

Yea but doesn’t the translate not really move the collision? unless ofcourse I parent it to an object that does move.

Also setting the linear velocity is an idea I tried, but it reacted really wild.

The closest thing I got was when I jump I turned off the linear damping = 0 when in the air, and when I land I set it to 0. BUT then now my left and right movements are HIGH OCTANE! since there is no more linear damping in the air. lol it’s a mess.

Should be a bit simpler

Err… Who said to use translate? :stuck_out_tongue:

When there was no input from the player, did you set the XZ velocity to 0?

Wait how else can you move the character without translate? I use apply force but is there another way?

No i didn’t try that yet with the XY velocity, but if I put it to 0 it will stop acceleration sure, BUT if i’m holding it down… this dude is going to be flying for DAYS right?

The problem was that Linear Damping worked on all axis. I suggested that you apply damping yourself on the axis in script to give you greater control.

If you are setting the velocity, it should only be going at that velocity. No acceleration is applied.

Thank you very much can you give me an example of each of these Solutions

Very quick version of the ‘setVelocity’ method.

Imperfect as it won’t handle slopes (you will have to do raycasting and do some maths to work out the angle of the slope) and you can do some more polishing of doing some acceleration up/down when using the controls.

The linear damping method would be just applying a force on the XY axis going in the opposite direction scaled by the velocity on said axis.

1 Like

Amazing thanks I’ll share my results if I find an alternative, youre the best!

So not only does it work the way I wanted I made some adjustments so that now it will focus on the player’s RIGHT direction. Allowing for some fun 3d stuff for a 2d game :slight_smile:

Let me know if you think this could be improved anyone else :smiley:

This code below is for the basic left and right movement for a side scroller where the y (Jump Velocity) is not affected (Some of the variables are fired in the initialize stage)

    var velocity = this.velocity;
    var x = this.entity.right.x;
    var z = this.entity.right.z;
    var currentVelocity = this.entity.rigidbody.linearVelocity;
    velocity.set(x * this.move, 0, z * this.move).normalize().scale(this.moveSpeed);
    velocity.y = currentVelocity.y;
    this.entity.rigidbody.linearVelocity = velocity;
        this.move = 1;
    } else if({
        this.move = -1;
    } else {
        this.move = 0;

Here is code that I put in for the jump! I put it under a numerical value so that way you can add jump amounts (Double jump, etc)

if( && this.canJump < 2){
        this.entity.rigidbody.applyImpulse(0,this.jumpAmount * this.jumpBoost,0);
    // This is when you fall you can get an extra kick to help you make up for the fall velocity.
    if(velocity.y < 0){
        this.jumpBoost = 1.75;
    } else {
        this.jumpBoost = 1;

Thanks again @yaustar and i hope this helps others in the future. :slight_smile:

I’m having the same issue - I need the linear damping to get my controller physics feeling right, but the linear damping is affecting the gravity too, so I can’t use it.

What exactly does linear damping do in terms of forces etc.? I’ve tried digging through the engine code to find it, but couldn’t track it down.

Does it modify the velocity directly? For example, what does a linear damping of 0.9 actually do to the rigid body forces under the hood?


You will need to look at the Bullet C++ code (which Ammo is complied from) to see how they apply damping:

This shows it applying damping to all axes of the vector. Instead, you can use the same logic but for only some of the axes

Awesome, thanks so much!