Making my character slowly stop

I’m making a racing game where you control a marble and I want to add a mechanic where you begin braking when you hold a certain button. This will make the ball come to a gradual stop a little faster that if you held the opposite direction the ball is moving. Does anyone know how I can do this?

this is what my code looks like for movement and it does a similar thing for forward and backward movement.

Under the physics contraints of the mesh, there are things like mass, friction, etc. You can play with those, add/remove mass or whatnot depending on what button you press?

Otherwise, insofar as ‘force’ w/regards to physics, you are doing the right way. Forces are usually the summation of force-vectors, then applied. Here you are just-adding another vector so it will work out. Is it ‘correct’ to do so? Correct doesn’t really apply if it does what you want it to :smiley:

That’s a good idea. I was iffy about it at first because increased weight would make the ball fall faster, but it would only be logical to brake on the ground anyways.

To be clear, I don’t know what values you want to futz with here, only that ‘there’ is a place you can alter the behavior of your physics-thing. Therefore, there is likely some kind of solution ‘over there’. :smiley:

Sometimes we’re not aware of all the options available to us, so…just an FYI here, I cannot offer a hard-solution (sorry).

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.