U
U
Uncle Bogdan2021-06-16 15:04:19
Unity
Uncle Bogdan, 2021-06-16 15:04:19

How to make OnCollisionEnter work without Rigitbody?

Tipo OnCollisionEnter does not work, if there is no Rigitbody on some object, then it does not work.

60c9e841b0899044012163.png

60c9e84d29955000178573.png

Code on one of these objects

private void OnCollisionEnter(Collision collision)
    {
        Debug.Log("Gucci");
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Spartanec33, 2021-06-16
@motkot

Is there a need to not use Rigidbody on both bodies? I think in order to check whether the bodies collided one of them should be able to move, of course, no one bothers to move the body using Translate, for example. Rigidbody will not do anything bad, even if you do not want the bodies to be physical, the Rigidbody component has constraints in the inspector, you can limit the degrees of freedom there. And if you click all the checkboxes there, you get a completely non-physical body with a Rigidbody. So it doesn’t work without a Rigidbody, as I understand it, due to the fact that it is in it that the item responsible for detecting collisions is located.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question