T
T
TooMajot2021-03-04 16:57:35
Unity
TooMajot, 2021-03-04 16:57:35

How to create inertia in my script in Unity3d?

private void FixeUpdate()
    {
        Vector3 direction = Vector3.forward * Input.GetAxis("Vertical") + Vector3.right * Input.GetAxis("Horizontal");
        rb.velocity = new Vector3(direction .x * speed * 10 * Time.deltaTime, direction .y * speed * 10 * 
                          Time.deltaTime, direction .z * speed * 10 * Time.deltaTime);
    }


How can I create inertia using this code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
freeExec, 2021-03-04
@freeExec


Inertia is the property of a body to remain in some reference frames in a state of rest or uniform rectilinear motion in the absence of external influences, and also to prevent a change in its speed in the presence of external forces due to its inertial mass. Wikipedia

Here also prevent change, instead of at once change.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question