How can I fix my jump mechanic?

I implemented jumping with applyImpulse.

My problem is that for smooth movement, I have to set linearDamping higher than angularDamping. When I’m falling after the jump, my character floats.

Can I somehow change those linear and angular damping dynamically?

Thank you in advance

What I did before is implement my own version of linear damping but only on the XZ axis so that the Y axis is untouched for things like jumping.

Alternatively, you can apply a downwards force if the player is in the air.

And how do I do so?

You could also increase the gravity but I won’t recommend that.

1 Like

Is there an option that you would recommend?

Actually Nevermind, you could change the gravity because a while back I was working on a project and I had the same issue but I just increased the gravity. Though when you increase the gravity it affects the other objects.

1 Like

And how do I implement this?

1 Like

I don’t quite get it. It is already set up like this.

I think I didn’t explain it well: I want the jump to be angular but I can’t have angular and linear damping at the same time.

How do I access linear and angular damping from my movement script?

the gravity for the test was about -59.2 and to access angular and linear damping in code you just do this.entity.rigidbody.angularDamping = number; or this.entity.rigidbody.linearDamping = number;


Great! It works! Thx!

There is just one thing left: When I jump and move at the same time, it goes way too fast. Can I set the movement in the x- and z-axis to linear and the jump on the y-axis to angular?

Sorry, I cant understand. if you mean to reduce the amount of force being applied on an axis you could just change the linear factor

1 Like

I did, but it still doesn’t work.

Let me try to explain: When I jump, my code changes, like you suggested me, angularDamping to 0.99 and linearDamping to 0 (well, except for the numbers). The problem is that when I jump, I also move on the x- and z-axis with an angular movement. I tried to change the angularFactor to (0, 1, 0) but it still won’t work.

Do you understand now? And if yes, have you got a solution to that?

1 Like

That’s odd it should be working if you set the x and z to 0.

1 Like

Which factors should I set to 0?

The X , Z should be set to 0. can i get the project link?

1 Like

in the script set the linear damping to 0.99

1 Like

Lets chat in the editor

It works now. though you might wanna increase the jump height

1 Like