T
T
TooMajot2021-03-03 19:06:33
Unity
TooMajot, 2021-03-03 19:06:33

How do I get rid of the ever-increasing inertia in Unity3D?

The code:

private void FixedUpdate()
    {
        Vector3 directionKeyboard = Vector3.forward * Input.GetAxis("Vertical") + Vector3.right * Input.GetAxis("Horizontal");
        rb.AddForce(directionKeyboard * speed * Time.fixedDeltaTime, ForceMode.VelocityChange);
    }


The object that is moving is a spaceship, and to implement the inertia I used AddForce.
But the problem is that the inertia is constantly increasing, and the ship accelerates strongly.

How can I get rid of the ever-increasing inertia?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-03-03
@TooMajot

Well, you constantly apply a new force to it
Read about velocity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question