B
B
bad22vk2020-10-26 18:41:26
Unity
bad22vk, 2020-10-26 18:41:26

How to make a rebound? When taking damage?

Hello again !
Here asked a question, but he and did not dare.
You need to dodge when taking damage.
The movement is implemented through Velocity , I was told that it is necessary to disable Velocity at the time of taking damage so that the character can be moved along X. But I don't know how to do it.

if (collision.gameObject.tag == "Vrag")
        {
            gameObject.GetComponent<Rigidbody2D>().AddForce(transform.up * direction * powerForce + transform.right * direction * powerForce, ForceMode2D.Impulse);
            TakeDamagee();
            hpText.text = ((int)hp).ToString();
        }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2020-10-26
@GavriKos

No need to duplicate questions.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question