B
B
Bruh_Bruh2020-09-11 11:32:24
Unity
Bruh_Bruh, 2020-09-11 11:32:24

Why doesn't object repulsion work?

Hello, there is a player and an object that should be repelled if the player touches it. It seems that everything was logically done, but when it touches, the object does not repel from the player. Now the script looks like this:

public Rigidbody rb;

void Start()
{
rb = GetComponent();
}

void OnCollisionEnter(Collision collision)
{
rb.AddForce(0f, 0f, 15);
}

Tried to do and through the trigger, all the same it is impossible.
Player
5f5b34b46043c374262293.jpeg
Inspector: Object Inspector:
5f5b3536d4231641754332.jpeg

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question